Anonymous function syntax
Jacob Carlborg
doob at me.com
Thu Sep 22 23:53:43 PDT 2011
On 2011-09-22 23:08, bearophile wrote:
> Andrei Alexandrescu:
>
>> A function literal should be comparable to another for equality.
>
> Are you willing to explain me why, and show an use case?
>
> Bye,
> bearophile
When using lambdas as event handlers:
class Foo
{
event[] events;
void registerEventHandler (void delegate (event) dg)
{
if (!events.contains(dg)) // register a given just delegate once
events ~= dg;
}
}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list