www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8420] New: isExpression and templates should capture all template parameters when using variadic TemplateParameter

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8420

           Summary: isExpression and templates should capture all template
                    parameters when using variadic TemplateParameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com



PDT ---
template TemplateInfo( T ) {
    static if ( is( T t == U!V, alias U, V... ) ) {
        alias U Template;
        alias V Arguments;
    }
}

The above template easily matches Tuple!(whatever), since Tuple is a template
with only one parameter, which is variadic. It does not, however, match
Rebindable!MyClass, since that template does not follow the pattern.

The idea behind bug 3608 was to cover exactly this, but it has been
insufficiently communicated in that report, hence this new report.

tl;dr: inside an IsExpression, T... should match a whole TemplateParameterList,
not just a TemplateTupleParameter.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 23 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8420





 tl;dr: inside an IsExpression, T... should match a whole TemplateParameterList,
 not just a TemplateTupleParameter.
I think, now almost of cases have been covered in 2.060head. What case isn't covered? ---- template TemplateInfo( T ) { static if ( is( T t == U!V, alias U, V... ) ) { alias U Template; alias V Arguments; } } struct Rebindable(T) {} struct Tuple(T...) {} struct Map(alias X, T...) {} struct Pack(int n, T...) {} alias TemplateInfo!( Rebindable!int ) T; pragma(msg, T.Template, " -> ", T.Arguments); alias TemplateInfo!( Tuple!(int) ) U; pragma(msg, U.Template, " -> ", U.Arguments); alias TemplateInfo!( Tuple!(int, int) ) V; pragma(msg, V.Template, " -> ", V.Arguments); alias TemplateInfo!( Tuple!(int, 10) ) W; pragma(msg, W.Template, " -> ", W.Arguments); alias TemplateInfo!( Map!(Map, int) ) X; pragma(msg, X.Template, " -> ", X.Arguments); alias TemplateInfo!( Pack!(10, "str") ) Y; pragma(msg, Y.Template, " -> ", Y.Arguments); alias TemplateInfo!( Pack!(10, int) ) Z; pragma(msg, Z.Template, " -> ", Z.Arguments); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 23 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8420


Simen Kjaeraas <simen.kjaras gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



PDT ---


 I think, now almost of cases have been covered in 2.060head.
 What case isn't covered?
No, I think that covers it. Great work! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 23 2012