www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8010] New: Type deduction problem


           Summary: Type deduction problem
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: wfunction hotmail.com

--- Comment #0 from wfunction hotmail.com 2012-05-01 04:15:35 PDT ---
private import std.range;
void filter(R)(R, bool delegate(ElementType!R)) { }
void main() { [1, 2, 3].filter(delegate bool(x) { return x < 3; }); }

This tells me the type 'R' isn't defined, so it's a bug.

More generally, getting delegates to work with templates is *too* painful.
It may not look terribly 'severe' at first glance, but it makes lambdas pretty
useless -- especially when /everything/ is inferred (e.g. if I had said x =>

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