bug in typeof or wrong enum specs?
captaindet
2krnk at gmx.net
Thu Aug 29 09:15:55 PDT 2013
thanks dicebot, jacob, rainer.
now i understand better what is going on and why.
however, i don't see the issue fully resolved. in
enum IDENTIFIER;
IDENTIFIER is an identifier, there is no way around it. the enum declaration makes it a type too, but it continues to be an identifier. an identifier is a "PrimaryExpression". a "PrimaryExpression" is an "Expression", any expression is officially allowed in typeof. but it throws an error because this expression is a type too.
same goes with
alias IDENTIFIER2 = int;
i don't think it can/should be fixed for identifiers only but instead typeof() should cover types in general:
typeof(IDENTIFIER) = IDENTIFIER
typeof(IDENTIFIER2 ) = int
typeof(int) = int
i see only advantages in this and it would clean up meta code from handling corner cases. (at least in my case, but being still on the newbie side of D programming i might not do it right.)
/det
More information about the Digitalmars-d
mailing list