Make dur a property?
Adam D. Ruppe
destructionator at gmail.com
Wed Jan 23 14:19:17 PST 2013
On Wednesday, 23 January 2013 at 22:07:30 UTC, Timon Gehr wrote:
> IIRC Adam likes to have both fun = value and fun(value)
> available for the same function.
Yeah, it is sometimes useful for methods that can be both chained
and assigned:
foo.bar(10).baz("hello");
vs
foo.bar = 10;
foo.baz = "hello";
...and sometimes just as a quick convenience when hunting bugs
(yup, I'm kinda for writeln = str; because you can throw that in
without hunting for the end of the expression to put in the close
paren.
I see no reason to change the current behavior for non- at property.
Now, for @property setters, we might use them for other
operations too.
@property int a() { return 10; }
@property void a(int v) { ... }
a += 10;
should be transformed into a(a() + 10); which is not currently
done.
More information about the Digitalmars-d
mailing list