DIP42 - Add enum E(T) = expression; eponymous template support

bearophile bearophileHUGS at lycos.com
Tue Jun 25 15:15:33 PDT 2013


Walter Bright:

> http://wiki.dlang.org/DIP42

I like it, it feels natural (probably other persons have invented 
the same idea).


In C++14 they wish to add generic lambdas:
http://en.wikipedia.org/wiki/C%2B%2B14#Generic_lambdas

Like:

auto lambda = [](auto x, auto y) {return x + y;}

In D we use generic lambdas often:

import std.stdio, std.algorithm;
void main() {
     [1, 2, 3].reduce!((x, y) => x + y).writeln;
}

But it's not immediate to assign a generic lambda:

alias sum = (x, y) => x + y;

Bye,
bearophile


More information about the Digitalmars-d mailing list