ref on hidden this param

TwoOfCups TwoOfCups at notreal.com
Sun Oct 5 05:28:49 UTC 2025


I am guessing I'm not the first person to think of this.

But allowing ref to be applied to the hidden this on member 
functions would be nice.
could be used for lazy init of objects, reassigning the lvalue 
and stuff.

Seem like a very easy thing technically so idk if there is some 
ideological reason not to?

right now we can do
```
class C{}
void foo(ref C c){...}
C c;
c.foo();

```

Which is pretty good, but an un-attached floating function can 
often get lost from the type they are meant to be attached to 
during certain import scenarios or certain template  scenarios so 
its actually not a robust solution.


More information about the Digitalmars-d mailing list