First Draft: ref For Variable Declarations

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Apr 12 21:16:52 UTC 2024


- "Enable local variables do be declared as ref."

s/do/to/

- Are they automatically scope as well?

- So this doesn't support borrowing from a data structure?

Why not?

Closing what I call DIP1000's last big hole, would allow this.

```d
DS ds = ...;
Wrapper wrapper = ds[...];
ref item = wrapper.get;

wrapper.destroy;
item.writeln; // error
```

This would be awesome to have.

- What is the point of this if the previous point isn't it?

An alias would be more appropriate for the example given.


More information about the dip.development mailing list