DIP23 draft: Fixing properties redux

Jonathan M Davis jmdavisProg at gmx.com
Tue Feb 5 01:01:23 PST 2013


On Tuesday, February 05, 2013 09:34:06 Jacob Carlborg wrote:
> BTW, if it does get lowered to methods, do we want to be able to access
> the instance variable directly?

No, because the variable would presumably end up with a compiler-chosen name 
which would presumably be implementation-dependent. All that the programmer 
has defined is the name of the property, not the name of the underlying 
variable.

And for the most part, it wouldn't matter. For structs, inlining would fix the 
problem, and for classes, if you really want to be able to access the member 
variable directly for efficiency, you can always declare the property functions 
explicitly.

- Jonathan M Davis


More information about the Digitalmars-d mailing list