On 2013-02-03 09:16, Andrei Alexandrescu wrote:
Very reasonable in the majority of the proposal.Walter and I have had a discussion on how to finalize properties.
I can't, however, get my head around 2-arg property functions:
int a_;
@property void a(int v, bool rev=false) { a_ = rev ? -v : v; }
a = 10; // fine
10.a = true; // this feels backwards, true is just an extra flag
The boolean flag is optional and making it the rhs of the assignment suggests it is the value which will be set. On the other hand switching argument positions, resulting in true.a = 10 also feels very strange.
I'd say: allow only 0 or 1 argument in properties.
If you need more arguments, write a normal function for it.