enum scope

Timon Gehr timon.gehr at gmx.ch
Thu Jan 26 10:43:25 PST 2012


On 01/26/2012 02:41 PM, Jacob Carlborg 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;
>

public is the wrong keyword. Furthermore, the solution is not better 
than mixin Import!Foo; I think the extern(C) enum proposal is pragmatic 
and makes more sense.


More information about the Digitalmars-d mailing list