Custom attributes (again)

Adam D. Ruppe destructionator at gmail.com
Fri Apr 6 06:48:12 PDT 2012


On Friday, 6 April 2012 at 12:52:27 UTC, Jacob Carlborg wrote:
> Just as we have today with keywords and symbols, I don't see 
> the problem.

Things like safe aren't keywords though. They are just
magic identifiers.

Think of the implementation:

switch(tok.ident) {
    case Id::safe:
    case Id::property:
     // etc for built ins
    default:
     // handle user ones here
}

If you were to define a struct safe {}, which is perfectly
legal D, and try to use it, you won't get what you expect.

It will trigger the case safe before it goes to the default.
So, the user defined one will just be quietly hidden.


More information about the Digitalmars-d mailing list