On Mon, 28 Jan 2013 11:31:33 -0500, Timon Gehr <[email protected]> wrote:

On 01/28/2013 06:22 AM, Steven Schveighoffer wrote:
...

I would be satisfied with Kenji's implementation.  As I understand it:

@property on a getter would mean implicit calling of the function.
@property on a setter would mean calling x = y as x(y).
@property functions could not be called like normal functions.
Parentheses are optional on normal no-arg functions when used as getters.
Normal single arg or variadic functions are NOT ALLOWED to be used as
setters.
...

This proposal unfortunately does not work too well because of UFCS.

As many have stated in the past, UFCS getter properties can annotate their "this" argument:

@property void by5(this int x) { return x * 5;}

by5 = 1; // error

Another possibility is to only define @property for setters. This is something I've come to realize that if we are simply going to allow omittable parens on getters, there is no functional value to @property on them except for the rare case of a delegate property. That was always one of those things where I think too much emphasis was on that as a reason for @property existence, it's very rare.

-Steve

Reply via email to