Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small tweaks to "Local variable declarations" #1208

Open
wants to merge 3 commits into
base: draft-v8
Choose a base branch
from

Conversation

RexJaeschke
Copy link
Contributor

[This proposal is the result of a private conversation I had with Nigel, and is intended to reflect our final agreement.]

I’m working on the spec for a future feature that involves changes to §13.6.2.1 General, in the grammar that starts with rule local_variable_declaration. However, once I started reading the draft V8 spec of that section, I got confused. I think some text, a grammar rule name, and a section name are misleading, and I’d like to change them before I continue with the other task.

In V6 (prior to the addition of ref/ref-readonly on locals), this section was simple, but as the grammar allowed all kinds of invalid constructs w.r.t implicitly typed local variable declarations, there was a non-trivial bullet list of constraints expressed in text. My original proposal for the V7 feature ref/ref-readonly locals involved light edits to that section. However, it appears that during TG2’s integration of that feature, the grammar was completely rewritten to incorporate all the previous text constraints, and broken into 3 subparts, each of which got its own new section (along with a General intro), as follows:

  • 13.6.2 Local variable declarations
    • 13.6.2.1 General
    • 13.6.2.2 Implicitly typed local variable declarations
    • 13.6.2.3 Explicitly typed local variable declarations
    • 13.6.2.4 Ref local variable declarations

§13.6.2.1 General starts by saying

Local variable declarations fall into one of the three categories: implicitly typed, explicitly typed, and ref local.

My interpretation was that this implied the three categories are mutually exclusive, when they are not! (A ref local could be implicit or explicit.) In any event, Nigel and I agreed to disagree on that interpretation, but we agreed this para adds no value and should be removed.

We agreed to rename rule ref_local_variable_declaration to explicitly_typed_ref_local_variable_declaration, which requires Section “13.6.2.4 Ref local variable declarations” to be renamed “13.6.2.4 Explicitly typed ref local variable declarations” with any links to that section being updated.

The grammar in “13.6.2.2 Implicitly typed local variable declarations” contains ref_kind, but doesn’t explain that, so a pointer to “13.6.2.4 Ref local variable declarations,” which does explain that, should be added.

@RexJaeschke RexJaeschke added meeting: discuss This issue should be discussed at the next TC49-TG2 meeting meeting: proposal There is an informal proposal in the issue, worth discussing in a meeting labels Nov 14, 2024
@RexJaeschke RexJaeschke added this to the Pre-C# 8.0 milestone Nov 14, 2024
@RexJaeschke RexJaeschke self-assigned this Nov 14, 2024
Copy link
Contributor

@Nigel-Ecma Nigel-Ecma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert explicitly_typed_ref_local_variable_declarators. The rest looks good and I approve in advance once the reversion is done.

ref_local_variable_declaration
: ref_kind type ref_local_variable_declarators
explicitly_typed_ref_local_variable_declaration
: ref_kind type explicitly_typed_ref_local_variable_declarators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: ref_kind type explicitly_typed_ref_local_variable_declarators
: ref_kind type ref_local_variable_declarators

See next comment for reason

;

ref_local_variable_declarators
explicitly_typed_ref_local_variable_declarators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
explicitly_typed_ref_local_variable_declarators
ref_local_variable_declarators

This rule is a list of ref_local_variable_declarator so should be named at it, there is no explicit type in the declarator. Note implicitly_typed_local_variable_declaration also uses ref_local_variable_declarator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meeting: discuss This issue should be discussed at the next TC49-TG2 meeting meeting: proposal There is an informal proposal in the issue, worth discussing in a meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants