@property - take it behind the woodshed and shoot it?
Adam Wilson
flyboynw at gmail.com
Thu Jan 24 17:30:54 PST 2013
On Thu, 24 Jan 2013 17:27:52 -0800, kenji hara <k.hara.pg at gmail.com> 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
> int y1 = bar(); // disallowed, calling int is meaningless
> int y2 = bar; // ok
> int z1 = baz(); // ok
> int z2 = baz; // *disallowed* by @function attribute
>
> How about?
>
> Kenji Hara
Very clever Mr. Hara, I like it a lot! But good luck convincing
Walter+Andrei. :-)
--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/
More information about the Digitalmars-d
mailing list