Uniform Function Call syntax for properties
Steven Schveighoffer
schveiguy at yahoo.com
Fri Oct 8 05:55:25 PDT 2010
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?
i.e.
int y = foo = 3;
or
int y = (3).foo;
???
I know arrays have an issue with property setters, see a bug report I
filed a while back:
http://d.puremagic.com/issues/show_bug.cgi?id=3857
But that seems like a totally unambiguous case (a global property function
with two parameters is obviously a setter on the first parameter in UFC).
The getter seems much more problematic. Does anyone have a solution
besides adding more syntax? Should we disallow global properties to avoid
ambiguity?
-Steve
More information about the Digitalmars-d
mailing list