enum scope

Timon Gehr timon.gehr at gmx.ch
Thu Jan 26 10:40:21 PST 2012


On 01/26/2012 07:21 PM, Gor Gyolchanyan wrote:
> That would break the independence between parser and semantic
> analyzer, because there's no way to disambiguate "bar" from "Foo.bar"
> without knowing, that "Foo" is actually an enum.
>

No, it would not. The parser does not have to care.

> On Thu, Jan 26, 2012 at 5:41 PM, Jacob Carlborg<doob at me.com>  wrote:
>> On 2012-01-26 14:23, Trass3r wrote:
>>>>
>>>> It's not type safe in C. But you can wrap it in a struct with alias
>>>> this instead.
>>>
>>>
>>> Yep, but in D we have strong enums, so why not use them.
>>
>>
>> What about be able to do something like this:
>>
>> enum Foo
>> {
>> public:
>>     bar,
>>     fooBar,
>> }
>>
>> Foo f = bar;
>>
>> --
>> /Jacob Carlborg
>
>
>



More information about the Digitalmars-d mailing list