enums extension
Robert DaSilva
spunit262 at yahoo.com
Tue May 15 23:24:53 PDT 2012
On Wednesday, 16 May 2012 at 05:49:01 UTC, Mehrdad wrote:
> On Wednesday, 16 May 2012 at 04:22:18 UTC, Comrad wrote:
>> Dear developers and community,
>> I want to draw you attention to the topic which was already
>> discussed here:
>> http://forum.dlang.org/thread/9to6n8$12d6$1@digitaldaemon.com
>> and here:
>> http://forum.dlang.org/thread/bl1n0e$1km5$1@digitaldaemon.com
>>
>> My question is: was something similar already done? are there
>> some plans to do that?
>
> Dunno... but the way I'd use them would be more like:
>
> enum AccessMask
> {
> GENERIC_READ = 0x80000000,
> GENERIC_WRITE = 0x40000000,
> GENERIC_EXECUTE = 0x20000000,
> GENERIC_ALL = 0x10000000,
> //....
> }
>
> enum FileAccessMask : AccessMask
> {
> FILE_READ_DATA = 0x0001,
> //...
> }
The inheritances notation implies that it's a subset and can be
assigned to an instances of the base. This would not be true with
enums.
FileAccessMask foo = FileAccessMask.FILE_READ_DATA;
AccessMask bar = foo; // Error
More information about the Digitalmars-d
mailing list