First Draft: ref For Variable Declarations
Timon Gehr
timon.gehr at gmx.ch
Wed May 1 21:10:54 UTC 2024
On 4/12/24 22:43, Walter Bright wrote:
> https://github.com/WalterBright/documents/blob/984374ca885e1cb10c2667cf872aebc13b4c1663/varRef.md
I am not sure how, but I had missed this thread so far. I am very much
in favor, I have wished for this many times over the years. 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.
(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.)
More information about the dip.development
mailing list