wrote this up in a random discord channel, figured it was worth sharing more widely:
the other metaphor i like to use for stacked borrows (or memory models in general), which maybe only makes sense in my brain: **memory allocators are fractal, and pointer aliasing rules are just malloc/free**
* your kernel allocates pages of memory from hardware (or whatever)
* your malloc implementation (as in jemalloc) allocates pages from the kernel
* your Vec impl allocates slices of memory from malloc
* your program allocates cells of memory from your Vec impl
all of these things are referring to "the same" memory but we maintain these strict semantic boundaries between them:
* two things shouldn't be handed the same chunk of memory (mmap shenanigans aside)
* once a "lower level" hands off a chunk of memory to a "higher level", it largely agrees to Not Fuck With It for the duration (instrumentation aside)
if any "lower level" allocator is made to believe that an allocation has Gone Away (free), then all the derived sub-allocations that "higher level" allocators built on them are Fucked Forever (or it's a use-after-free, which we all agree is Mega UB, No Negotiations Allowed). that is, if malloc hands a page back to the kernel, your Vec *extremely* needs to not be using the slice of memory that was derived from it.
stacked borrows basically continues the metaphor:
* a mutable reference is like a sub-allocation for the chunk of memory it points to
* you can reborrow mutable references into multiple disjoint mutable references (just like malloc splits up a page into slices) (see slice::split_at_mut for a concrete example)
* you can do this over and over, building up a "stack" of reborrows (a stack of sub-allocations)
* but as soon as you access a mutable reference at a "higher level", you MUST pop everything off of the stack until it's at the top
that is, accessing an "older" mutable reference invalidates all the mutable references derived from it, as if "free" was just called on all those sub-allocations!
because remember: allocators agree to not fuck with allocations they handed out, so if you start fucking with one, you need to revoke all those hand-outs or you're breaking the allocator contract!
i think the most disturbing allegation to me is actually not that they're deliberately bombing civilian targets. it's that they're bombing faster than they can generate targets with human intelligence, and are using AI to fill the gaps. now that's dystopian
https://www.972mag.com/mass-assassination-factory-israel-calculated-bombing-gaza/
you have to read this article. if even half of it is true, and it's incredibly detailed, it explains a Lot (it's about how the IDF picks targets and how they have loosened the rules significantly with this conflict)
Mental health advice be like 'It's okay to take a step back! Prioritise getting more sleep! Spend more time in nature!' while carefully avoiding the elephant in the room that the reason I can do none of these things is because 5/7ths of my life is dominated by that non-optional 'having a job' thing. Tell me how I can 'take a step back' from that and I'll be right there.
damn dude this rolling stone piece goes hard, rip bozo
https://www.rollingstone.com/politics/politics-news/henry-kissinger-war-criminal-dead-1234804748/
Sorry for missing image descriptions. I wrote long image descriptions and then in a technical mishap I lost them, and now I'm very tired. I will describe the images for you on request, just not tonight.
IF CRUELTY IS THE POINT OF FASCISM, Americans have turned their bureaucracies into violent, cruelty machines.
it is going to take more than voting out the fascists.
the cruelty is social.
the cruelty is economic.
the cruelty is systemic.
the cruelty is cultural.
how do you radically change a culture to become antifascist?
how do you radically change the mundane so it wont produce and reproduce systemic violence?
that's the real antifa work: to break the cycle of MUNDANE cruelty. /4
The *reason* C required me to build all this stuff is C is only a language, and doesn't contemplate any broader ecosystem. That means no cross-compatible ecosystem can ever be built, and if you want to express things like "and here's a bit of code you run when building" or "and you need these dependencies", that has to be bolted on with external steps. Rust doesn't need *you* to do that work because a build.rs simply parses an "SVD" xml file containing those build variables and register addrs.
But haven't you heard? Rust is fast and safe!!! You don't need to think applicability to your specific task and compare the tradeoffs, not when Rust is fast and safe!!!11!!!!!1!1!1! Nothing else is safe, certainly not basically every language other than C and C++; and nothing else has ever been fast either, it's not like even Java is fast enough to run on 2003-era microcontrollers embedded in tiny SIM cards!
"A proposal, dear reader:
Create a list of bookmarks linking to websites you find interesting, and publish it for the world to see. It's a bit strange, almost nobody seems to be doing this. Looking through a sample of personal websites, very few of them has links to other personal websites. A hyperlink isn't a marriage proposal. It is enough to find some redeeming quality in a website to link to it. It costs nothing, and helps bring traffic to pages that you yourself think deserve it."
Trans woman, bisexual, someone's fiancée, forever a programmer, poly, and former total mess
Avatar by mavica