This seems like it'd be a great move for organizing enums more and clearing up
some redundant module resolution. I think that trying to clean things up in a
'match' would just complicate matters; I don't see the problem in either
scoping the enum or 'using' it within the module. You make a great point,
Patrick, about C++ and its addition of 'enum class' in C++11; I'd say it was a
great move and it might be best to make the same decision as early as possible.
Since I don't consider the additional scope resolution a problem, I'd say the
biggest downside is probably the invalidation of nearly all existing Rust code.
Jeaye
On Mar 22, 2013, at 5:41 PM, Patrick Walton wrote:
> On 3/22/13 5:10 PM, Martin DeMello wrote:
>> Since this is breaking everything anyway, how about syntax to let the
>> match run inside the enum namespace? e.g.
>>
>> enum Color { Red, Green, Blue }
>> fn main() {
>> let x = Color::Red;
>> match Color::{x} {
>> Red => ...
>> Green => ...
>> Blue => ...
>> }
>> }
>
> Seems to add complexity to the grammar for something that could be done with
> `use self::Color::*;`
>
>> Or even infer that x is of type Color and let the compiler
>> transparently allow omitting the prefix within the match.
>
> That would intertwine name resolution and typechecking, which would add a lot
> of complexity to the compiler (if it's even coherent to do so; it might not
> be).
>
> Patrick
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev