Re: Privatize a few members to allow messing with them #11353

2020-06-30 Thread matheus via Digitalmars-d-learn
On Tuesday, 30 June 2020 at 20:01:43 UTC, Stanislav Blinov wrote: On Tuesday, 30 June 2020 at 19:58:05 UTC, matheus wrote: +loc.linnum = loc.linnum + incrementLoc; This works because it was declared: void linnum(uint rhs) { _linnum = rhs; } Right? Almost. Given these

Re: Privatize a few members to allow messing with them #11353

2020-06-30 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 30 June 2020 at 19:58:05 UTC, matheus wrote: +loc.linnum = loc.linnum + incrementLoc; This works because it was declared: void linnum(uint rhs) { _linnum = rhs; } Right? Almost. Given these definitions: @safe @nogc pure @property { const uint linnum() { return

Re: Privatize a few members to allow messing with them #11353

2020-06-30 Thread matheus via Digitalmars-d-learn
On Tuesday, 30 June 2020 at 19:55:56 UTC, matheus wrote: On Tuesday, 30 June 2020 at 19:46:35 UTC, Stanislav Blinov ... @safe @nogc pure @property { const uint linnum() { return _linnum; } const uint charnum() { return _charnum; } void linnum(uint rhs) { _linnum

Re: Privatize a few members to allow messing with them #11353

2020-06-30 Thread matheus via Digitalmars-d-learn
On Tuesday, 30 June 2020 at 19:46:35 UTC, Stanislav Blinov wrote: 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,

Re: Privatize a few members to allow messing with them #11353

2020-06-30 Thread Stanislav Blinov via Digitalmars-d-learn
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

Privatize a few members to allow messing with them #11353

2020-06-30 Thread matheus via Digitalmars-d-learn
Hi, I was looking the PR in DMD and I found this one: https://github.com/dlang/dmd/pull/11353/ One of the changes was: -loc.linnum += incrementLoc; +loc.linnum = loc.linnum + incrementLoc; I usually do the former and I particularly hate the later, so my question is,