On 2/7/2012 7:00 PM, Niko Matsakis wrote:

I am talking about our type system as implemented. We treat immutable
fields as covariantly typed, meaning that {x:T1} <: {x:T2} if T1 <: T2.
This is sound so long as the field x is really immutable; but it is not.
Here is an example of where this leads to bad results:

Goodness. You're quite right, this should have never occurred. Ok.

*shakes fist at subtyping*[1]

-Graydon


[1] which I never wanted[3], exactly because most structural variance rules that look attractive on paper produce these kinds of nightmares when you actually try to implement them in terms of structures in memory. Likewise record extension, sum-restriction, field permutation, etc. etc.

[2] yes, I know we needed[3] something to deal with const / mutable?

[3] life's unfair[4] sometimes.

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

Reply via email to