digitalmars.D - Function Literals
- Brian Schott (12/12) Apr 15 2014 Valid, but rejected by DMD:
- Brian Schott (6/9) Apr 15 2014 Sorry, disregard this one.
Valid, but rejected by DMD:
void function() a = {writeln("a");}, b = body {writeln("b");};
Valid, but rejected by DMD:
void function() a {writeln("a");}
Invalid, accepted by DMD:
void function() a = {writeln("a");};
Invalid, accepted by DMD:
// No semicolon needed if there's only one
void function() a = {writeln("a");}
For fun, accepted by DMD:
void function() bar[](alias t)(int x, int y) = { writeln("wat");
};
Apr 15 2014
On Tuesday, 15 April 2014 at 18:11:13 UTC, Brian Schott wrote:
Invalid, accepted by DMD:
// No semicolon needed if there's only one
void function() a = {writeln("a");}
Sorry, disregard this one.
In its place, let's use this, which is valid and rejected by DMD:
void function() bar {}
Decl:
StorageClasses(opt) BasicType Declarator FunctionBody
Apr 15 2014








"Brian Schott" <briancschott gmail.com>