First Draft: ref For Variable Declarations
Quirin Schroll
qs.il.paperinik at gmail.com
Tue May 21 10:09:09 UTC 2024
On Wednesday, 1 May 2024 at 21:10:54 UTC, Timon Gehr wrote:
> On 4/12/24 22:43, Walter Bright wrote:
>> https://github.com/WalterBright/documents/blob/984374ca885e1cb10c2667cf872aebc13b4c1663/varRef.md
>
> I think the only risk is implementation bugs in safety checks.
> The DIP seems a bit incomplete in this department, e.g., it
> does not say what happens when you take the address of a `ref`
> local. Maybe it can point to some prior art, but just stating
> that it cannot be returned seems neither sufficient nor
> necessary.
Can’t `ref T reference` simply be defined to have the same
semantics as `T* _reference` and `reference` is a shorthand for
`*_reference`?
> (Of course, it would be even better if fields could also be
> `ref`, but then you get into initialization safety. This is a
> general soundness problem in the current language though.)
Actually, you don’t because `null` references are valid in D.
More information about the dip.development
mailing list