On Friday, 17 September 2021 at 10:29:12 UTC, bauss wrote:
On Friday, 17 September 2021 at 09:44:53 UTC, Chris Katko wrote:
[...]

It's not a bug because "obj.x" referes to the same symbol that is "this.x"

Alias will create an alias for a symbol, not an expression or the like.

So

obj.x is the same as this.x and in that case the alias will refer to the same thing.

The problem here is that the function is local to the class, so the alias will always refer to the class members directly and not the passed instance.

You really shouldn't use alias like this anyway and should just use auto, if it's because you want to save typing.

It shouldn't have any impact at all tbh.

Thanks everyone!

Okay, so yeah, back in 2017 I definitely was still learning D. And, after a year or two, I was re-learning it... using this bad learner codebase! There's been plenty of other things I had to fix that are "no-nos" in my modern codebases.


Reply via email to