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

kenji hara k.hara.pg at gmail.com
Thu Jan 24 17:27:52 PST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130125/c4b8a0c7/attachment-0001.html>


More information about the Digitalmars-d mailing list