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...

And I'll be darned if "static" isn't the perfect fit :o).

This would give us:

meta.compiles(XXX)
meta.isArithmetic; // note, property syntax OK if no arguments
meta.isArithmetic(int*);

isArithmetic is library-implementable. How would the library inject stuff in the meta namespace? Also my alarm goes off when seeing meta.isArithmetic(int*) instead of meta.isArithmetic!(int*), which is what the unwashed masses would have to do if they wanted to implement a similar facility. With time I've acquired a dim view of certain stuff in the language benefiting of untouchable advantages.


Andrei

Reply via email to