How to declare an alias to a function literal type

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 12 09:34:49 PST 2016


On Tuesday, 12 January 2016 at 17:28:35 UTC, Marc Schütz wrote:
> On Tuesday, 12 January 2016 at 16:55:48 UTC, ParticlePeter 
> wrote:
>> [...]
>
> If I understand you correctly (not sure), you would like to 
> write `MF` so that you don't need to specify the parameters in 
> the lambda? That's not possible, because the code inside the 
> lambda needs names for them if it wants to access them, but 
> parameter names are _not_ part of the function type, and 
> therefore the alias doesn't know about them.
>
> However, you don't need to specify the full parameter list in 
> the lambda, the names and `ref` are enough:
>
>     otherFunc( (ref a, ref b, ref c) { /* use a, b, c */ } );

This is already quite useful, thanks.


More information about the Digitalmars-d-learn mailing list