@property - take it behind the woodshed and shoot it?

Jacob Carlborg doob at me.com
Mon Jan 28 11:47:10 PST 2013


On 2013-01-28 18:07, Steven Schveighoffer wrote:

> Another possibility is to only define @property for setters.  This is
> something I've come to realize that if we are simply going to allow
> omittable parens on getters, there is no functional value to @property
> on them except for the rare case of a delegate property.  That was
> always one of those things where I think too much emphasis was on that
> as a reason for @property existence, it's very rare.

I think @property adds clarity and shows intent. For example, now that 
we have UDA's I have create a struct called "attribute" which I use as 
an attribute for other structs to should be attributes:

struct attribute {}

@attribute struct foo {}

@foo int a;

Here @attribute shows the intent. This is also why I like to have 
explicit interfaces and abstract classes compared with C++ which doesn't 
not.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list