On 6/28/16 10:07 AM, Ola Fosheim Grøstad wrote:
On Tuesday, 28 June 2016 at 13:50:42 UTC, Steven Schveighoffer wrote:
On 6/28/16 7:35 AM, Ola Fosheim Grøstad wrote:
alias func = (int i) => i*i;
?
Is that valid in the compiler, or are you proposing it? I haven't used
or seen such a thing.
It does work:
----
import std.stdio;
alias func1 = (int i) => i*i;
alias func2 = function int (int i){ return i+i;};
void main(){
writeln(func1(3), " ", func2(4), " ", func1);
}
----
https://dpaste.dzfl.pl/5d35ab068c2b
That's pretty cool. Unfortunately, it's still a delegate/function.
I was thinking to define actual functions this way.
-Steve