@property Incorrectly Implemented?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 7 01:15:43 PDT 2016


On Tuesday, 6 September 2016 at 19:37:26 UTC, Jonathan M Davis 
wrote:
> but an @property function which returns by ref isn't worth 
> much, since you're then giving direct access to the member 
> variable which is what an @property function is usually meant 
> to avoid. If you wanted to do that, you could just use a public 
> member variable.

It can do lazy initialization, allow to set a breakpoint, log 
access etc.

> You're dealing with an @property function which is just trying 
> to emulate a variable.

That's the whole point. It's trying to emulate a variable, so why 
not make it do it?


More information about the Digitalmars-d mailing list