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

dsimcha dsimcha at yahoo.com
Mon Nov 2 10:34:12 PST 2009


== Quote from Don (nospam at nospam.com)'s article
> [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
> <snip>

I like the basic idea, though I think there are some details to be hammered out.
Why don't you post it to the DIP page on the wiki so that it's in a form that's a
little longer-lived than this newsgroup and conversations about it don't eat into
more general discussion here?

Also, I'll soon be posting a DIP for enhancing runtime introspection, which is
similarly a bit of a rat's nest right now.  Perhaps considering them in parallel
would be a good idea.



More information about the Digitalmars-d mailing list