@property with opCall
Adam D. Ruppe
destructionator at gmail.com
Mon Mar 9 12:14:06 UTC 2020
On Monday, 9 March 2020 at 10:09:56 UTC, Calvin P wrote:
> @property exists so many years, Druntime & Phobos use it
> 2280 times. I can't believe it is not recommended.
They never implemented it right. This opCall type thing was THE
case we brought up to introduce @property in the first place....
but it never actually affected this.
For years, @property did absolutely nothing. We were told to use
it for the future. Some people tried to put on a compiler switch
to make it do something, but they consistently made that switch
do the wrong thing! Then @property got frozen for fear of broken
changes. LOL.
Now @property changes the result of `typeof(a.prop)`... but
nothing else.
@property is one of the biggest WTFs of D's development.
Here's a wiki page referencing one of the 2013 discussions
https://wiki.dlang.org/Property_Discussion_Wrap-up
though i'll note the thing is older than that.
What especially drove me nuts is people would so often say
"property *syntax*" instead of "property semantics" - everyone
would go on and on and on about banning optional parenthesis
which should be a totally unrelated discussion when we should
have been talking about the semantic question and focusing on the
case you discovered - the case that actually matters.
More information about the Digitalmars-d-learn
mailing list