@property - take it behind the woodshed and shoot it?

Peter Alexander peter.alexander.au at gmail.com
Thu Jan 24 09:15:00 PST 2013


On Thursday, 24 January 2013 at 16:29:07 UTC, Andrei Alexandrescu 
wrote:
> On 1/24/13 3:57 AM, Jacob Carlborg wrote:
>> void delegate () foo ();
>>
>> foo() // would call the delegate ?
>
> Yes.
>
> a = foo; // fetch the delegate
> b = foo(); // fetch and invoke the delegate

How about generic code?

void callFunc(alias f, Args...)(Args args)
{
     f(args);
}

void delegate() foo();
void delegate(int) bar(int x);

callFunc!foo(); // calls delegate?
callFunc!bar(0); // calls bar?

Seems like a recipe for disaster.


More information about the Digitalmars-d mailing list