Trait keyword.

Namespace rswhite4 at googlemail.com
Sat Nov 2 15:01:10 PDT 2013


On Saturday, 2 November 2013 at 21:28:46 UTC, Adam D. Ruppe wrote:
> 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.

__if (true) {

} __else {

}

__for (...) {

}

__enum {

}

That looks beautiful to you?


More information about the Digitalmars-d-learn mailing list