Trait keyword.

Adam D. Ruppe destructionator at gmail.com
Sat Nov 2 14:28:45 PDT 2013


On Saturday, 2 November 2013 at 20:45:28 UTC, TheFlyingFiddle 
wrote:
> I'm basically wondering why the __traits keyword looks so 
> horrible.

I think it looks beautiful and wished all the keywords used the 
leading underscores.

The reason is that the __keywords are reserved, so they don't 
conflict with user words. __traits was added somewhat late into 
the language, so using a reserved word for it meant less broken 
code. Now you can still call your own variables traits - I'd love 
it if all keywords were this way so we could, in theory at least, 
use the anywhere.

Anyway, std.traits wraps __traits reasonably well and doesn't 
have the underscores.


More information about the Digitalmars-d-learn mailing list