Tagged enums why reserved words are not permitted ?

Domingo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 27 17:31:43 PDT 2014


Hello !

I'm not sure if I'm missing something here but for a tagged enum 
it doesn't seem to make sense to forbid reserved keywords like:

enum CrudOps {read, write, delete}

The dmd compiler are complaining:
------
cte.d(4): Error: basic type expected, not delete
cte.d(4): Error: no identifier for declarator int
cte.d(4): Error: type only allowed if anonymous enum and no enum 
type
cte.d(4): Error: if type, there must be an initializer
cte.d(4): Error: found 'delete' when expecting ','
------

It doesn't make sense to me because this kind of enum will not 
polute the global space and always need to beused with the tag: 
CrudOps.delete

I'm missing something here ?

Cheers !


More information about the Digitalmars-d-learn mailing list