After our meeting yesterday I was thinking that perhaps `Freeze` is not the best name for what is now `Const`. Given that we wound up disliking `Owned` because it described a property of the type, and not what you could do with it, perhaps the best name for `Const`/`Freeze` would be something related to sharing between threads. Therefore I nominate `Share` (or some similar name).
`Share` seems more analogous to `Send` and, I think, makes it easier to reason about when the type is appropriate: - ARC: Mutated privately atomically, still shareable - RC: Mutated privately but non-atomically, not shareable - Cell: Mutated privately but non-atomically, not shareable - `@`, `&`: Immutable, shareable, see below. - `@mut`, `&mut`: Inherently mutable, not shareable - Joe random struct: No interior mutability, shareable One complication is `@` and `&`. These types are `Const` but cannot (today) be shared between threads. However, I hope to change this by adding fork-join style parallelism. The idea would be to build on the type `fn:Share()` (meaning: a closure that cannot mutate its environment) and offer methods like `pmap` on vectors that execute their iterations in parallel. In this context, the name `Share` is perfect, because it distinguishes between values that can be shared between threads but cannot be *sent* between threads (meaning: no transfer of ownership). Granted, this forkjoin parallelism design is speculative and may not come to pass. Another complication is that we have sometimes called `@T` a "shared box". But that name is deprecated in favor of managed. Or maybe someone else can come up with another word that conveys "shared between parallel tasks" more precisely. Anyway, I wanted to toss that out there. Niko _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
