Minor feature request

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 28 07:07:32 PDT 2016


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





More information about the Digitalmars-d mailing list