Is the -property compiler flag broken/bad idea?

Adam D. Ruppe destructionator at gmail.com
Wed Jun 5 15:25:20 PDT 2013


On Wednesday, 5 June 2013 at 21:36:26 UTC, Jonathan M Davis wrote:
> Walter and Andrei pretty much consider
> @property to have been a failure and seem to want to get rid of 
> @property and go to pretty much what we had before.

Blah I hope that doesn't happen.

I'm the author of the quoted bit in the OP, and have made my 
hatred of -property well known in the past.

But, I probably wouldn't even loathe -property so much if it 
actually *worked*, that is, solved the problem(s) that led to 
@property's introduction in the first place:

1) returning especially callables (property_name() should call 
the return value, not the function)

2) ambiguous type/reference given function_name (is 
typeof(property_name) the type of the function or the type of the 
return value? For @properties, I say it should be the latter, for 
other functions, the former)

3) prop += 5 and friends


When -property first came out, I was actually kinda excited for 
it. Finally, my JavascriptObject code could work as intended! 
Sure, it'd be a hassle to fix stuff like my dom.d code that uses 
optional parens a lot, but it'd be worth it if that dynamic type 
code worked correctly.

...Then I tried it, and it fixed nothing. So when it broke dom.d 
even more than I thought, and the years passed, yes it has been 
years now, and it still fixed nothing, it just became completely 
dead to me.


BUT, and this is important, items #1, #2, and #3 are *still* 
problems! That's what @property can and should fix. Throwing it 
away entirely is a step in the wrong direction.


More information about the Digitalmars-d-learn mailing list