Getter an lvalue and cannot be modified

IntegratedDimensions IntegratedDimensions at gmail.com
Sun May 27 09:23:09 UTC 2018


C[] c;
@property C[] get() { return c; }

get ~= something;

errors out, yet

auto q = get;
q ~= something;

is fine.


Why is D thinking that ~= is being applied to get, the function, 
rather than what it returns?

Also

When I converted a field in to a property, an AA, it is returning 
null rather than being initialized by default. Seems like 
properties are broke. I'd expect a property getter to behave, for 
all intents and purposes as if it were field. I shouldn't have to 
have a temp variable to be able to use it as such.



More information about the Digitalmars-d-learn mailing list