First Draft: ref For Variable Declarations
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sat Apr 13 18:02:51 UTC 2024
On 14/04/2024 4:15 AM, Walter Bright wrote:
> On 4/12/2024 3:13 PM, Richard (Rikki) Andrew Cattermole wrote:
>> Borrowing memory from other variables will be attempted, and will be
>> attempted often and that will cause frustration as an obvious feature
>> isn't supported.
>
> This is not a proposal to add DFA.
Indeed.
What I'm seeing is that we are limiting ourselves in designs so that
things that people will expect to work, will not work. Simply because
the compiler doesn't have a DFA capable of verifying program security.
For instance here is Atila saying how returning by ref is good because a
variable cannot be declared as ref.
https://forum.dlang.org/post/ebytqnxztjsbtxtcnzke@forum.dlang.org
Except with this DIP this is no longer the case.
And one example from 2021 that shows someone wanting it.
https://forum.dlang.org/post/mtefqmzpefkuehliodfd@forum.dlang.org
Someone from C++ wanting to do exactly as I am suggesting 2013.
https://forum.dlang.org/post/mailman.700.1370235898.13711.digitalmars-d-learn@puremagic.com
I know there have been more discussions about this over the years even
if I didn't find them.
More information about the dip.development
mailing list