http://d.puremagic.com/issues/show_bug.cgi?id=3702

           Summary: Replace __traits and is(typeof()) with a 'magic
                    namespace'
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bugzi...@kyllingen.net


--- 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:
http://www.digitalmars.com/d/archives/digitalmars/D/Proposal_Replace_traits_and_is_typeof_XXX_with_a_magic_namespace_._99914.html

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.compiles(XXX)
meta.isArithmetic; // note, property syntax OK if no arguments
meta.isArithmetic(int*);

Benefits:
* Fewer keywords: __traits -> meta, typeid() -> meta.typeid()
* Get rid of is() expressions, which are the most complicated thing in the
language.
* 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: -------

Reply via email to