digitalmars.D.bugs - [Issue 8560] New: Strange behavior of lambda expressions
- d-bugmail puremagic.com (38/38) Aug 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8560
- d-bugmail puremagic.com (13/13) Aug 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8560
- d-bugmail puremagic.com (9/11) Aug 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8560
- d-bugmail puremagic.com (9/11) Aug 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8560
http://d.puremagic.com/issues/show_bug.cgi?id=8560 Summary: Strange behavior of lambda expressions Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: iu.biryukov gmail.com I came up with this code while playing around with D: import std.stdio; public class Test(alias fun, alias fun2) { void doIt() { fun(); fun2(); } } void main() { (new Test!( () => {writeln("fun1");}, () => writeln("fun2") ) ).doIt(); } After compiling this code I expect to see the following output(or compiler error, if I'm misusing lambda syntax): fun1 fun2 Insted I get: fun2 DMD64 D Compiler v2.060 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8560 klickverbot <code klickverbot.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |code klickverbot.at Resolution| |INVALID --- Marking as invalid, since {writeln("fun1");} is a parameterless delegate literal. This delegate is returned by the call to fun(), but never invoked. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8560Marking as invalid, since {writeln("fun1");} is a parameterless delegate literal. This delegate is returned by the call to fun(), but never invoked.Thanks, now I get it. background. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8560 ---background.Mhm, even if the current behavior is to spec, it can definitely be surprising. If you feel something should be done about this, please consider starting a discussion on the forums. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 18 2012