[Issue 9608] New: Add introspection for templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 27 05:12:47 PST 2013


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

           Summary: Add introspection for templates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at erdani.com


--- Comment #0 from Andrei Alexandrescu <andrei at erdani.com> 2013-02-27 05:12:46 PST ---
Currently given a template symbol it's not possible to do simple introspection
on it, such as getting arity, distinguishing alias vs. type parameters, and
figuring out variadics.

Example:

    template A(alias sym)
    {
        ...
    }
    A!((a, b) => a.name < b.name);

A is unable to tell the number of parameters of the lambda. It could if it knew
what type to instantiate it, and in order to know that it needs the actual
instantiation type. There should be enough introspection chops to compute the
number of parameters without instantiating the lambda.

There would be a fair amount of design involved because currently there's no
kind that expresses a template's parameters outside the template.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list