On 13-02-21 10:54 PM, Patrick Walton wrote:
> Hi everyone,
> 
> Based on some discussions today, I'd like to float the idea of merging
> the Cell and Mut types into a single type called Cell. The reasoning
> here is basically that the two types are very similar in functionality,
> and the distinction between "lowercase-m mut" and "capital-M Mut" seems
> likely to be confusing to me.

I'm certainly keen on getting rid of Mut. But I talked briefly with Niko
on IRC about this and got the impression that it might not be too zany
to counter-propose removing Cell as well (at least once we h ave once
functions). Which I shall now do: can we remove both?

In particular, I feel like Cell (as presented here) is, much like the
quickly-vanishing mut fields, a mechanism for breaking the type system,
or for aspects of the type system we want to be true and have been
pushing towards making-true, but aren't currently (as you say: the
freezable == owned identity).

I'd prefer we keep moving towards having one blessed-and-safe mechanism
for this (@mut) and one unsafe mechanism (*mut) that you're responsible
for wrapping up in an API that doesn't shoot yourself in the foot, and
file down the remaining type system complexity so people can predict
freeze/thaw, ARC-based sharing and such by reasoning about the rules,
not worrying about the presence of a rule-breaking substructure.

I realize this means you get a level of indirection when you use
mutability inside a non-owned structure. This is a potential perf cost,
but I don't know how common it'll be in practice. So far it seems like
things that are perf sensitive are leaning towards Owned in most cases
anyways (and if not due to only-using-~[], then using some unsafe bits
that respect Owned semantics and are hidden inside a safe Owned API).
I'm willing to bet this will not be an overriding perf sore spot, at
this point.

Also recognize that this requires us to get once functions working, and
may not provide an answer for moving out of non-once closures. Not
convinced this is a bad enough case to warrant Cell. Might be wrong.

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to