I have a feature request: "Named enum scope inference"
Tommi
tommitissari at hotmail.com
Fri Sep 28 20:14:54 PDT 2012
On Saturday, 29 September 2012 at 02:37:40 UTC, Alex Rønne
Petersen wrote:
>
> Regardless of the conditions under which to throw an error, it
> would be a breaking change.
I guess that's a bad thing. Hmmm... too bad.
Well... maybe we could make it so that variables of the requested
enum type are looked up first, and if such is found (even with a
same name as one of the enumerations), then that variable is
used. Only if no variables of that name exist, then you see if
the name correctly maps to a named enum literal, and if not then
you see if you can map the name using the enum type name as its
scope. I think that's quite a logical rule anyway, because if
you've defined a variable of the correct enum type and pass it to
a function, you quite likely meant to pass that variable to that
function (instead of passing an enum literal).
More information about the Digitalmars-d
mailing list