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

eles eles at eles.com
Fri Jan 25 00:21:09 PST 2013


On Friday, 25 January 2013 at 01:28:05 UTC, kenji hara wrote:
> 2013/1/25 Adam Wilson <flyboynw at gmail.com>
>
>> On Thu, 24 Jan 2013 17:15:09 -0800, kenji hara 
>> <k.hara.pg at gmail.com>
>> wrote:
>>
>>>
>>> 1. Optional parentheses for normal functions should work 
>>> shallowly IMO.
>>> 2. Optional parentheses for property functions should not 
>>> work. Applying
>>> ()
>>> for property function name always applied to its returned 
>>> value.
>>>
>>> #1 is a ratification of current behavior. It allows the 
>>> combination of
>>> UFCS
>>> and removing redundant ()s.
>>> #2 is a breaking change. If we need it, community consent is 
>>> required.
>>>
>>> Kenji Hara
>>>
>>
>> I can completely agree with this change. It is perfectly 
>> workable to fix
>> properties without changing optional parens. I just won't use 
>> them :-P
>
>
> I have thought an additional idea.
> If we really want a feature to disable optional parentheses for 
> normal
> functions, we can add @function attribute to the language spec.
>
> int foo();
> @property int bar();
> @function int baz();  // new!
>
> int x1 = foo();  // ok
> int x2 = foo;  // optional parentheses, allowed

I dunno, but for me the line above is a function pointer that is 
stored into an integer for later retrieval and use.


More information about the Digitalmars-d mailing list