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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 24 10:17:48 PST 2013


On 1/24/13 12:15 PM, Peter Alexander wrote:
> 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.

Agreed. This is a good litmus test. One option we had in mind was to 
still keep @property for disambiguating such cases.

Andrei


More information about the Digitalmars-d mailing list