digitalmars.dip.development - Second Draft: ref for Variable Declarations
- Walter Bright (2/2) May 02 https://github.com/WalterBright/documents/blob/01291980cbfd80b85575fc6f8...
- Nicholas Wilson (22/24) May 02 This DIP has an implementation, you should link to it.
- Richard (Rikki) Andrew Cattermole (15/22) May 02 I didn't know that it worked with same scope and was counter proposing
- Walter Bright (11/19) May 03 Not exactly. Accessing global variables takes a varying number of instru...
- Nicholas Wilson (7/18) May 03 Then you should explain that in the DIP and use that to argue by
- Walter Bright (9/24) May 03 You're right, but what is the point? Aren't they rather obvious? After a...
- Nicholas Wilson (3/7) May 03 Then you should note in the DIP that no changes to the grammar
- Nick Treleaven (3/5) May 04 It's the first sentence of the description:
- Mike Parker (21/22) May 21 This DIP has been committed to the repository as DIP1046 and the
https://github.com/WalterBright/documents/blob/01291980cbfd80b85575fc6f8ba44d0d433cd4f8/varRef.md This is pretty much done.
May 02
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. 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 should include a diff of the relevant parts of there grammar (where appropriate). Your example that purports to show the utility of the new feature is already accomplishable by `alias` ```d void pop87(int line, const(char)* file) { alias g = global87; // ... use `g` ``` as noted by Rikki in the previous thread.
May 02
On 03/05/2024 4:19 PM, Nicholas Wilson wrote:Your example that purports to show the utility of the new feature is already accomplishable by |alias| |void pop87(int line, const(char)* file) { alias g = global87; // ... use `g` | as noted by Rikki in the previous thread.I didn't know that it worked with same scope and was counter proposing expansion. But yeah it totally does. ```d import std; int global; void main() { int var; alias g = global; alias v = var; writeln(g, v); // 00 } ```
May 02
On 5/2/2024 9:19 PM, Nicholas Wilson wrote:Your example that purports to show the utility of the new feature is already accomplishable by `alias` ```d void pop87(int line, const(char)* file) { alias g = global87; // ... use `g` ```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.
May 03
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.
May 03
On 5/2/2024 9:19 PM, Nicholas Wilson wrote:On Friday, 3 May 2024 at 03:43:39 UTC, Walter Bright wrote:Ok.https://github.com/WalterBright/documents/blob/01291980cbfd80b85575fc6f8ba44d0d433cd4f8/varRef.md This is pretty much done.This DIP has an implementation, you should link to it.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 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.
May 03
On Friday, 3 May 2024 at 08:08:13 UTC, Walter Bright wrote:Then you should note in the DIP that no changes to the grammar are needed.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.
May 03
On Friday, 3 May 2024 at 08:59:19 UTC, Nicholas Wilson wrote:Then you should note in the DIP that no changes to the grammar are needed.It's the first sentence of the description: https://github.com/WalterBright/documents/blob/01291980cbfd80b85575fc6f8ba44d0d433cd4f8/varRef.md#description
May 04
On Friday, 3 May 2024 at 03:43:39 UTC, Walter Bright wrote:This is pretty much done.This DIP has been committed to the repository as DIP1046 and the review process is complete: https://github.com/dlang/DIPs/blob/a5b42f15e8c7b8d7b037465eba08d620c3f85198/DIPs/DIP1046.md Given that Walter is the author, I put the DIP on the agenda for our most recent monthly meeting and asked if there were any objections to submitting it to Atila for the formal assessment. No objections were raised. The following people were present for this portion of the meeting: Jonathan M. Davis Timon Gehr Martin Kinkelin Dennis Korpel Mathias Lang Mike Parker Robert Schadek Steven Schveighoffer Adam Wilson Thanks to everyone who left feedback in both review threads. Please do not comment further in this thread. If you'd like to say more, please start a new thread in the General forum.
May 21