[Issue 12421] New: Allow simpler syntax for lambda template declarations
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 20 03:23:31 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12421
Summary: Allow simpler syntax for lambda template declarations
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-20 03:23:28 PDT ---
-----
void main()
{
import std.algorithm;
import std.traits;
{
static auto notEmpty(Arr)(Arr arr) { return !arr.filter!(a => a >
0.0).empty; }
assert(notEmpty([0.0, 0.0, 0.1]));
}
{
// simpler syntax should be supported
alias notEmpty = a => a.filter!(b => b > 0.0).empty;
assert(notEmpty([0.0, 0.0, 0.1]));
}
}
-----
Note how much code has to be written for a "throwaway" inline function
definition in the first case. This could be simplified by supporting the second
syntax.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list