Cases where I miss C++ 'using'
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Tue Nov 7 08:00:25 PST 2006
Daniel Keep wrote:
>> Finally I wish there were some way to bring all the values in an *enum*
>> into the current name resolution scope. For example:
>>
>> enum Buttons {
>> Left,
>> Right,
>> Middle
>> }
>> with(Buttons) { // doesn't work!
>> x = Left|Middle
>> }
>> alias Buttons B;
>> y = B.Left | B.Middle; // ok, but not as nice looking
>>
>>
>> --bb
>
> Allowing you to use an Enum's name without the prefix is one of the
> things I actually miss about Visual Basic. Sure, requiring the prefix
> is nice for the sake of organisation, but it gets *really* aggravating
> after a while.
I mostly use enums inside switch statements. Java makes a nice
compromise here by only requiring the prefix outside switches. I don't
like making them accessible everywhere without prefixing.
More information about the Digitalmars-d
mailing list