▲ | nixpulvis 4 days ago | |||||||
No mention of how this is safe when operating on data across threads? One of the biggest wins for Rust is sane treatment of references when using parallelism. | ||||||||
▲ | verdagon 4 days ago | parent [-] | |||||||
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... | ||||||||
|