@property as proposed in various DIPs, my attempted use and what I think of it

Stewart Gordon smjg_1998 at yahoo.com
Thu Feb 21 15:14:05 PST 2013


On 20/02/2013 20:32, Jonathan M Davis wrote:
> On Wednesday, February 20, 2013 20:41:24 Rob T wrote:
>> The reality is that I often don't know if I'll be using one
>> syntax over the other until usage experience is gained and the
>> usage context determines the answer. I may even want to use both
>> forms depending on the use context.
>
> I don't understand this. You make it a property function if it's intended to
> be used as if it were a variable. If it's not, then you don't mark is a
> property. Done. Where's the confusion?
<snip>

I entirely agree.  I don't have as much time to read the 'groups as I 
used to, so haven't managed to follow all the discussions about it.

It's hard to say what are the main advantages of @property over making 
every function with zero or one parameter usable as a property.  But 
I've come to like it since it was introduced.  And it's useful not only 
to programmers, but also to documentation generators.

In any case, some of the suggestions seem worse than what we had before 
@property....

Perhaps the only change I'd vote for is dropping the @, which doesn't 
seem to mean anything.

Stewart.


More information about the Digitalmars-d mailing list