Second Draft: ref for Variable Declarations

Walter Bright newshound2 at digitalmars.com
Fri May 3 08:08:13 UTC 2024


On 5/2/2024 9:19 PM, Nicholas Wilson wrote:
> On Friday, 3 May 2024 at 03:43:39 UTC, Walter Bright wrote:
>> https://github.com/WalterBright/documents/blob/01291980cbfd80b85575fc6f8ba44d0d433cd4f8/varRef.md
>>
>> This is pretty much done.
> 
> This DIP has an implementation, you should link to it.

Ok.


> Most of the `Rationale` section is exposition (describing existing behaviour), 
> not rationale. The last line of the rationale is parenthetical to the abstract, 
> not the rationale. The actual rationale (comments about the use of `ref` in 
> `foreach`), should be written as stating the upside of the use of such `ref`s, 
> not that no downsides exist. You should give examples as to times when you felt 
> the feature should exist (or link to them elsewhere in the document) rather than 
> assert they exist (with no evidence).

You're right, but what is the point? Aren't they rather obvious? After all, we 
all have experience with ref parameters in D, and ref variables in foreach, that 
have the same purpose. Refs are well known and exist in other languages, like 
C++ and C#. Is there any controversy here? What refs do and what they're good 
for is completely constrained by the behavior of the existing uses of ref.


> You should include a diff of the relevant parts of there grammar (where 
> appropriate).

There are no changes to the grammar. Ref locals were previously rejected in the 
semantic pass.



More information about the dip.development mailing list