digitalmars.D.bugs - [Issue 3531] New: 'curry' doesn't work for templated functions
- d-bugmail puremagic.com (33/33) Nov 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3531
- d-bugmail puremagic.com (15/15) Nov 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3531
- d-bugmail puremagic.com (9/9) Nov 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3531
- d-bugmail puremagic.com (11/11) Nov 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3531
- d-bugmail puremagic.com (11/11) Jan 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3531
http://d.puremagic.com/issues/show_bug.cgi?id=3531 Summary: 'curry' doesn't work for templated functions Product: D Version: 2.036 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: samukha voliacable.com PST --- auto add(A, B)(A x, B y) { return x + y; } void main() { alias curry!(add, 5) add5; assert(add5(6) == 11); } test.d(57): Error: template std.functional.curry!(add,5).curry(T) if (is(typeof(fun(arg,T.init)))) does not match any fu nction template declaration test.d(57): Error: template std.functional.curry!(add,5).curry(T) if (is(typeof(fun(arg,T.init)))) cannot deduce templat e function from argument types !()(int) The problem is with the constraint for curry(T)(T arg2). Remove the constraint to workaround. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3531 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla kyllingen.net 06:29:58 PST --- The is(typeof(...)) constraint can be replaced with __traits(compiles, ...). This works: auto curry(T)(T arg2) if (__traits(compiles, { fun(arg, T.init); })) { return fun(arg, arg2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3531 PST --- Just want to note that it is not __traits(compiles) that makes the example work, but the function being wrapped in the delegate literal. This works as well: auto curry(T)(T arg2) if (is(typeof( { fun(arg, T.init); } ))) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3531 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com 10:05:39 PST --- Thanks much. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3531 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED 23:29:44 PST --- Fixed a while ago. Added unittest with 2287. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2011