Is the -property compiler flag broken/bad idea?

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 5 17:26:11 PDT 2013


On Wednesday, June 05, 2013 17:12:38 H. S. Teoh wrote:
> I was hoping for a clean way for functions to imitate class/struct
> variables via @property, independently of whether or not non- at property
> functions are allowed to be called without parens. But alas, it was not
> to be. :-/

Part of the problem is that it's pretty much impossible to do completely. 
You'll never be able to make it so that swapping between variables and 
property functions (in either direction) is guaranteed to not break code. So, 
the question becomes at what level you attempt it.

And it's not necessarily the case that @property is dead. It's strict property 
enforcement which is definitely dead (in which case, there would have been no 
optional parens). What exactly is going to happen with @property is not clear, 
but given what -property does, there's pretty much no way that -property is 
sticking around (not with its current semantics anyway). We may yet end up 
with @property giving us something (like a way to deal with having a property 
return a delegate cleanly), but it _is_ true that Walter and Andrei are 
leaning towards axing it entirely. And unfortunately, to resolve it, we're 
bound to need another long discussion on the topic. But it'll probably help if 
such a discussion starts with the premise that we are not going to do anything 
to restrict optional parentheses. Since without that, the discussion will 
degrade pretty quickly.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list