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

Walter Bright newshound2 at digitalmars.com
Thu Jan 24 12:19:32 PST 2013


On 1/24/2013 10:17 AM, Andrei Alexandrescu wrote:
> 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.

Another option is f(args) always requires parens, even if args expands to 0 args.



More information about the Digitalmars-d mailing list