Why this doesn't produce an error or works as expected?
partypooper
pythonproof at gmail.com
Fri Jul 4 18:14:23 UTC 2025
On Friday, 4 July 2025 at 18:04:55 UTC, partypooper wrote:
> It doesn't work. Or it works even worse: changing _pos, but not
> _dest. What is going on is that on `+=` it for some reason
> invokes "getter", not "setter". I specifically omitted "ref",
> because I already have known of that behavior.
In other words you through reference of the "getter" which
returns "_pos" setting it to the right part of the "+=". Which in
ideal world should error too.
You can get what i'm want is to duplicating
```d
_dest.x = _pos.x
_dest.y = _pos.y
``` In a getter, but it is definitely not sound right.
More information about the Digitalmars-d-learn
mailing list