@property - take it behind the woodshed and shoot it?
Adam D. Ruppe
destructionator at gmail.com
Thu Jan 24 13:24:58 PST 2013
On Thursday, 24 January 2013 at 21:09:39 UTC, Adam Wilson wrote:
> The problem with @property isn't @property, it's D's
> insistence on optional parens.
No, this isn't a problem; function call syntax has nothing
whatsoever to do with @property because a property is NOT
logically a function!
This is so important: a property is supposed to be
indistinguishable from a data member. That's the fundamental
definition. It should be fully interchangeable for a plain data
member.
In other words, as far as the user is concerned, a property *is*
a data member, NOT a function!
If functions have optional parens, that changes nothing about how
you access data members.... and since properties are data
members, it changes absolutely nothing about them either.
If we required data to be accessed with foo->bar and methods to
be called [foo:bar].... a property would be accessed foo->bar.
The method syntax is irrelevant.
That the property is implemented with a function call should not
be known to the user code.
More information about the Digitalmars-d
mailing list