Proposal: Replace __traits and is(typeof(XXX)) with a 'magic namespace'.

Steven Schveighoffer schveiguy at yahoo.com
Mon Nov 2 10:17:36 PST 2009


On Mon, 02 Nov 2009 13:17:18 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Don wrote:
>> [I'm moving this from deep inside a TDPL thread, since I think it's  
>> important]
>>  is(typeof(XXX)) is infamously ugly and unintuitive
>> __traits(compiles, XXX) is more comprehensible, but just as ugly.
>>  They are giving metaprogramming in D a bad name. I think we need to  
>> get rid of both of them.
>>  A very easy way of doing this is to replace them with a 'magic  
>> namespace' -- so that they _look_ as though they're functions in a  
>> normal module.
>> Names which have been suggested include 'meta', 'traits', 'scope',  
>> 'compiler'. Personally I think 'meta' is the nicest (and I suggested  
>> two of the others <g>).
>
> Another keyword, sigh...

Wouldn't meta *replace* a keyword?  i.e. no more __traits.

Maybe I misunderstand the proposal, but that's what I thought.

-Steve



More information about the Digitalmars-d mailing list