On 08/02/2012 9:18 AM, Niko Matsakis wrote:
In principle, as I wrote before, we could patch up the big hole by being
more restrictive about variance. There may be other holes. But frankly I
feel pretty strongly that if a field is declared immutable, it ought to
mean that no matter how many times you read that memory location, you
get the same result. This property would not be preserved in such a
system and I think that's undesirable. It's also true that getting rid
of field variance is itself rather ham-fisted and will lead to numerous
unnecessary type errors, though perhaps improved inference might help.
A communication-note:
I understand you've developed strong thoughts about this, as has
pcwalton, and suspect it results from a lot of high-bandwidth, in-person
conversations in mountain view. I respectfully ask you to move *slowly*
and at a somewhat laborious, tedious-to-you pace on the topic, for the
"remoties" (marijn and myself). We've not been party to *any* of the
in-person whiteboarding or conversing that leads to this conclusion, so
the "to my mind ... only two options" statements come off as very
immediate, certain and restrictive.
IOW, there's a lot to think and talk about in this topic, and what seem
like cut-and-dried conclusions to you are "the first time we've heard
mention of it" to us.
(To me, for example, the notion that "var x = ..." would somehow lead to
x being "unassignable" seems curious and equally wrong. Because the
whole notion of a mutable slot (such as 'x') implies the ablility to
change its entire contents; that implicitly means "all of its
substructure"; otherwise you'd have to 'mutable'-annotate every single
bit in a substructure. I'd be curious to see what actually happens if we
lose mutability covariance on interior-structural types, or even explore
why you think those are the only two options. Fwiw the only place I
think I *use* mutability-subtyping is on vector types, which are
exterior. It feels premature to try to couple this decision to the
interior-vector problem, which is even more involved since the variance
of fixed vs. dynamic size types also comes into play ... all this says
that there's a lot of conversation we've *not had* yet.)
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev