On Saturday, 7 November 2026 at 20:09:23 UTC, An wrote:
On Saturday, 7 November 2026 at 04:05:20 UTC, Richard (Rikki) Andrew Cattermole wrote:
You need to think of ref as *v not as v.

So you copied the value out when you declared the variable.

We do have by-ref variables now:

``ref s2 = s.byRef();``

7FFF77B508B0 vs 7FFF77B508B0

`auto` should be extended support such syntax without the need of spell out `ref` storage

And how do you get a copy then?

```d
auto valueNotRef = (foo());
```

I think the current version of auto is easier to understand than the above example.

```d
void main() {
    auto value = foo();
    auto refff = &foo();
    ref refref = foo();
}

ref int foo() {
    static a = 0;
    a += 1;
    return a;
}
```

Reply via email to