Make dur a property?

Adam D. Ruppe destructionator at gmail.com
Wed Jan 23 14:46:33 PST 2013


On Wednesday, 23 January 2013 at 22:24:20 UTC, Nick Sabalausky 
wrote:
> that provides absolutely no useful value whatsoever.

Do you think so many of us would be arguing for it and using it 
if it was of no value whatsoever?

> Note that properties are *not* functions

Indeed, which is why I separate out -property, a stupid waste of 
time, and @property, a good idea.

Parenthesis and properties have nothing to do with each other. 
But when @property was proposed, we didn't talk about what it 
*is* (indistinguishable semantics from the return value), but 
instead what it *looks like* (must not be called with 
parenthesis).

That's where all this pain comes from. Two separate features got 
intertwined due to a sloppy DIP.


You're talking about removing a feature (optional parenthesis) 
from the language. We need to be weary of doing that. You say it 
is useless... but it *is* used by many of us. Changing it now has 
a cost. Even if it was worthless, the benefit of killing a 
worthless feature is smaller than the harm caused by breaking the 
code.

Similarly, I feel the new keyword is a detriment (indeed, I think 
new is less useful than optional parens). It doesn't do anything 
that can't be done in the library and gives special treatment to 
one preferred allocator (the gc), discouraging others and 
preventing easy replacement with user defined types (e.g. a 
create method that returns NotNull!T instead of T).

But the fact is that new is a feature in D today, and removing it 
would break a heck of a lot of code, so if I was given a vote on 
removing it... I'd vote to keep it how it is.




Now, property semantics are an entirely different issue, and 
thanks to the @property decoration, we CAN fix them without 
breaking anything else. That's a no-brainer to me, we should 
definitely do that.


More information about the Digitalmars-d mailing list