preview in: it seems that return type auto solves scope variable assignment to this
Dennis
dkorpel at gmail.com
Thu Feb 9 17:59:39 UTC 2023
On Thursday, 9 February 2023 at 17:42:00 UTC, Dmytro Katyukha
wrote:
> So, the first question is: where in this code assignment to
> `this` happens?
When calling a member function like `other.toAbsolute`, you're
assigning `other` to the implicit `this` parameter, as if you are
calling `toAbsolute(this: other)`.
> So, the second question is: what happens in this case?
Functions with `auto` return get attributes inferred, just like
template functions. The compiler infers `scope` based on the
implementation of `toAbsolute`.
More information about the Digitalmars-d
mailing list