Address of a lambda

NoIdeaForaGoodPseudo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 7 10:51:36 PDT 2017


On Friday, 7 July 2017 at 17:33:33 UTC, FoxyBrown wrote:
> In gtk, we routinly have to use delegates for callbacks. But 
> the methods that accept these delegates want the address of the 
> delegate, this prevents us from being able to pass a lambda in 
> directly, but there really is not reason why we shouldn't be 
> able to do this?
>
> [...]

Lambdas are for very localized and small delegates, typically in 
algorithms and functional programming. Delegates assigned to 
events in GUI toolkits are often meant to be reusable, e.g 
assignable to different listeners and also must be known (have 
addresses) to be usable in GUI designers. That's not what lambda 
are made for.


More information about the Digitalmars-d-learn mailing list