Bug 7308 – Lambda template literals

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-17T17:10:00Z
Last change time
2014-06-09T04:56:32Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-01-17T17:10:54Z
Currently (DMD 2.058head) this kind of code is not allowed, but I think it's handy to have (I suggest to require the () around the lambda template): void main() { alias (x => x ^^ 2) sqrTemplate; } Timon Gehr reminds me that the semantics of that code is already available, just with a longer syntax: template ID(alias a){alias a ID;} void main(){ alias ID!(x => x ^^ 2) sqrTemplate; }
Comment #1 by bearophile_hugs — 2012-01-19T10:38:16Z
A note from Philippe Sigaud: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=31736 > If you do an enhancement request, could you also add one for: > > alias __traits(whatever, whatever) some Result; > > Right now, the alias grammar doesn't allow this and I find this > limitation jarring.
Comment #2 by k.hara.pg — 2014-06-09T04:56:32Z
*** This issue has been marked as a duplicate of issue 12421 ***