On 06/24/2010 10:25 PM, Jonathan M Davis wrote:
Pelle wrote:
As heard around these parts, a lot of people want property-style
function calls to require the function to be declared with @property,
like this:
@property foo(); //getter
@property foo(int); //setter
foo; //getter
foo = 13; //setter
While this seems quite reasonable, in practice I and others feel this
leads to confusion, especially the getter part. Mostly when the getter
has no setter counterpart. D also lets us call no-argument functions
without parentheses today, so for this to happen a lot of code needs to
change.
My suggestion is as follows; require @property for single-argument
setters *only*. Make the silly writeln = 13; go away, but keep the "a b
c".split;. This way, there can be no confusion about @property, and most
code will go unchanged.
I hope this was not too late a suggestion. :)
I thought that the whole point of @property was that it enabled the
property-style function calls with no parens and that functions not labeled
with @property had to be called with parens.
- Jonathan M Davis
Also to disable writeln = 13;
But I want to keep paren-less calls and remove silly call-as-assignment,
except for when marked as to make sense.