Second Draft: ref for Variable Declarations

Nicholas Wilson iamthewilsonator at hotmail.com
Fri May 3 08:58:03 UTC 2024


On Friday, 3 May 2024 at 07:57:34 UTC, Walter Bright wrote:
> Not exactly. Accessing global variables takes a varying number 
> of instructions depending on the memory model. Using a ref 
> variable makes it a simple pointer. An alias is fundamentally 
> different, although in trivial cases they can appear to be the 
> same.
>
> There are three ways to refer to a value
>
> 1. by value
> 2. by reference
> 3. by name
>
> Alias is by name, you'll see it also in ref, alias, and value 
> parameters to function templates.

Then you should explain that in the DIP and use that to argue by 
access by name is undesirable compared to by ref (in whatever 
cases you add to prosecute the case for the DIP). All the DIP 
says at the moment is that "its can be done like this", it cites 
no additional logic as to why that is superior to option that 
currently work already in a syntactically analogous way.


More information about the dip.development mailing list