Privatize a few members to allow messing with them #11353
Stanislav Blinov
stanislav.blinov at gmail.com
Tue Jun 30 19:46:35 UTC 2020
On Tuesday, 30 June 2020 at 19:42:57 UTC, matheus wrote:
> in this case this was more a style thing than anything else
> right? Or is there something I'm not able to see?
Before the change, linnum and charnum are public variables, one
can do a += on them. After the change, they become properties
accessing, as the PR says, private variables:
@safe @nogc pure @property
{
const uint linnum() { return _linnum; }
const uint charnum() { return _charnum; }
void linnum(uint rhs) { _linnum = rhs; }
void charnum(uint rhs) { _charnum = rhs; }
}
...with which the += won't work (at least this variant, as the
getter isn't returning ref).
More information about the Digitalmars-d-learn
mailing list