Summary: Replace __traits and is(typeof()) with a 'magic
--- Comment #0 from Lars T. Kyllingstad <bugzi...@kyllingen.net> 2010-01-13
06:46:44 PST ---
This proposal was formulated by Don in the NG post at:
I repost it here because I think it is important. Quoting Don's proposal:
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>). This would give us:
meta.isArithmetic; // note, property syntax OK if no arguments
* Fewer keywords: __traits -> meta, typeid() -> meta.typeid()
* Get rid of is() expressions, which are the most complicated thing in the
* Some meta.XXX functions could be defined in runtime library code.
* The existing __traits functions could have more useful return values.
* Retain the flexibility of __traits.
--- (quote ends)
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------