Should aliasing a lambda expression be allowed?

Petar Petar
Thu Nov 16 13:05:51 UTC 2017


On Wednesday, 15 November 2017 at 19:29:29 UTC, Steven 
Schveighoffer wrote:
> On 11/15/17 11:59 AM, Andrea Fontana wrote:
>> On Wednesday, 15 November 2017 at 15:25:06 UTC, Steven 
>> Schveighoffer wrote:
>>> alias foo = lambda1;
>>> alias foo = lambda2;
>> 
>> What?
>
> Yep. Would never have tried that in a million years before 
> seeing this thread :) But it does work. Tested with dmd 2.076.1 
> and 2.066. So it's been there a while.
>
> -Steve

I guess you guys haven't been keeping up with language changes :P

https://dlang.org/changelog/2.070.0.html#alias-funclit

And yes, you can use 'alias' to capture overload sets.
See also:

https://github.com/dlang/dmd/pull/1660/files
https://github.com/dlang/dmd/pull/2125/files#diff-51d0a1ca6214e6a916212fcbf93d7e40
https://github.com/dlang/dmd/pull/2417/files
https://github.com/dlang/dmd/pull/4826/files
https://github.com/dlang/dmd/pull/5162/files
https://github.com/dlang/dmd/pull/5202

https://github.com/dlang/phobos/pull/5818/files


More information about the Digitalmars-d mailing list