▲ | verdagon 4 days ago | |
Great question! That's a big enough topic that I'd love to write a followup post about it. There's also a good thread on r/Compilers at https://www.reddit.com/r/Compilers/comments/1n2ay7g/comment/... about how Nick's model should support that. TL;DR: Mutability is tracked at the group level, so we can share an immutable group with any number of threads (especially good with structured concurrency) or lend a mutable group to a single other thread. References themselves are still aliasable, regardless of the group's mutability. Taking an existing (mutable, aliasing) group and temporarily interpreting it as immutable has precedent (I did it in Vale [0]) so I like the approach, but I might be biased ;) (This is from my memory of how Nick's proposal works, I'll ask him to give a better answer once morning hits his Australia timezone) [0] https://verdagon.dev/blog/zero-cost-borrowing-regions-part-1... | ||
▲ | nmsmith 4 days ago | parent [-] | |
Yep, that's an accurate summary! The model still features a form of "borrowing", it just happens at the granularity of groups. I wrote a more detailed answer here: https://news.ycombinator.com/item?id=45057636 |