On Thu, 24 Jun 2010 16:21:37 -0400, Pelle <pelle.mans...@gmail.com> 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. :)

writeln = 13; doesn't compile, just so you know. ;)

Reply via email to