On Sat, 09 Oct 2010 16:28:32 -0400, Denis Koroskin <2kor...@gmail.com>
wrote:
On Sun, 10 Oct 2010 00:09:23 +0400, Sean Kelly <s...@invisibleduck.org>
wrote:
Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
On 10/8/10 7:55 CDT, Steven Schveighoffer wrote:
Someone was asking about UFC syntax for properties on d.learn, and I
realized, we have a huge ambiguity here.
Given a function:
@property int foo(int x)
Is this a global setter or a getter on an int?
Good question.
Setter. Consider "a = b = c".
I think you missed the point. Which of the two is it:
int x = 42;
auto y = x.foo(); // transformed into "auto y = foo(x);", getter
or
foo = 42; // transformed into "foo(42);", setter
Both match.
I agree that there is ambiguity here, but does it why does foo have to be
only a getter or only a setter? Why can't it behave like either, depending
on its implementation and use?