Possible @property compromise

Rob T alanb at ucora.com
Tue Jan 29 15:55:13 PST 2013


On Tuesday, 29 January 2013 at 23:09:55 UTC, Jonathan M Davis 
wrote:
[..]
>
> If we go any route other than explicit properties, we're giving 
> up on the
> possibility of being able to swap variables and property 
> functions without
> breaking code.
>
> - Jonathan M Davis

Given how D currently works, I don't see how we can realistically 
implement a function as a drop in replacement for a variable and 
expect code to continue working as if nothing had changed.

One of the bigger problems is that the getter returns by value, 
not ref, so everything that expects a ref return will fail.

I expect to make precise variable emulation through properties 
will require a lot of compiler magic, and there will be 
inevitable bugs and conflicts that follow. I really don't see 
that there's enough value with the property concept to justify 
the costs of precise variable emulation.

You know a lot more about implementing compiler magic than I do, 
so I'll ask you if you think the effort is doable enough to 
justify having property functions that can act like a drop in 
replacement for existing variables?

--rt


More information about the Digitalmars-d mailing list