bug in typeof or wrong enum specs?
Maxim Fomin
maxim at maxim-fomin.ru
Thu Aug 29 10:17:30 PDT 2013
On Thursday, 29 August 2013 at 16:15:50 UTC, captaindet wrote:
>
> 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;
Grammar rule "expression" is not necessarily an expression in a
general sense of computing values, designating objects or
producing side effects.
> 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
Yes.
More information about the Digitalmars-d
mailing list