3 ms·
The original syntax for lambdas in D worked, but it was so clumsy nobody used it, and people even said "D doesn't have lambdas". Changing it to a much simpler s
by WalterBright 9y ago
The original syntax for lambdas in D worked, but it was so clumsy nobody used it, and people even said "D doesn't have lambdas". Changing it to a much simpler syntax changed everything.
old:
function double(double a, double b) { return a + b; }
new:
(a, b) { return a + b; }
Currently, the syntax for in/out contracts is being revised for usability:
https://github.com/dlang/DIPs/blob/98052839441fdb8c6cc05afccb9a81d084051c4d/DIPs/DIP1009.md https://github.com/dlang/DIPs/blob/98052839441fdb8c6cc05afcc...
D has a different syntax for templates than C++, and is far more approachable and convenient:
C++:
template<class T> void foo(T t) { }
template<class T> class S { };
D:
void foo(T)(T t) { }
class S(T) { }