On 7/10/2012 9:04 AM, David Bruant wrote:

If I can "concretize" a trait for an arbitrarily complex structure, why
would I create classes? Or could classes be seen as syntactic sugar over
traits+types?

Sugar, mostly. We're still trying to decide how sweet to make it. Also they introduce a nominal type, whereas many of our types are structural (i.e. two copies of the same type definition are type-equal). We're still not entirely sure if we can or should be merging the other nominal data constructor ('enum') with 'class', or if that's trying to force things that are better off remaining separate[1].

If it's the case, then the visibility control mechanism doesn't seem
necessary for traits anymore since visibility would be more a concern
for classes than for traits.

That's the idea, yes.

-Graydon

[1]: For those following along at home, I cannot help but point out the symmetry between the "case-class vs. enums" question and how we previously removed tuples in favour of "just records and enums", then got annoyed with the cases we wanted to write as tuples, so added them back in. Strictly speaking, redundant; but hey, so is everything beyond rule 110, doesn't keep us from quibbling over syntax.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to