@property - take it behind the woodshed and shoot it?

David Nadlinger see at klickverbot.at
Thu Jan 24 05:55:46 PST 2013


On Thursday, 24 January 2013 at 13:43:34 UTC, Adam D. Ruppe wrote:
> No, god no. This would break code AGAIN and still not fix the 
> problems, instead introducing new ones!
>
> I think any property proposal that talks about parenthesis in 
> the definition is wrong. With a good definition, the existing 
> type system will handle the parenthesis.
>
> @property int foo() { return 10; }
>
> foo(); // the correct error is "type int is not callable"
>
> This is the key point:
>
> A property is NOT a function as far as user code is concerned. 
> That's just an implementation detail.
>
> As far as user code is concerned, a property IS its return 
> value.
>
>
> If you implement that, leaving all the other rules in the 
> language exactly the same, we'll actually fix some problems 
> without breaking the overwhelming bulk of existing code.
>
>
> Fixing the rest of the problems is then about getting op*Assign 
> to work right.
>
>
>
> Functions not marked @property should NOT change AT ALL from 
> what we have now. I am against removing the existing optional 
> parenthesis rule, and I am against removing the @property 
> decoration.
>
> Fix it this time, don't break it in a different place.

I wholeheartedly agree.

David


More information about the Digitalmars-d mailing list