@property - take it behind the woodshed and shoot it?
Adam D. Ruppe
destructionator at gmail.com
Fri Jan 25 12:24:04 PST 2013
On Friday, 25 January 2013 at 19:59:59 UTC, Andrei Alexandrescu
wrote:
> 2. I have tried to add @property appropriately in Phobos, in
> particular for ranges:
These are examples of why I'm firmly in the pro-optional
parenthesis camp. With them, stuff like this becomes irrelevant;
it works either way.
But, remember, the problem @property needs to solve is none of
this. There's no pressing reason to put it on range functions.
My view is @property maybe somewhat rare in usage: if in doubt,
do NOT use it. But there's cases where there is no doubt, and we
don't want to throw the baby out with the bathwater there.
One example where I'd love property: a dynamic object. Suppose we
extend Variant to work Javascript style:
Variant v;
v.prop = function() { };
v.prop(); // we expect this to call the function, not return a
reference to it
That would be an @property.... range.popFront doesn't need to be.
It works fine with the existing optional parenthesis rule.
More information about the Digitalmars-d
mailing list