-
Notifications
You must be signed in to change notification settings - Fork 86
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
base: draft-v8
Are you sure you want to change the base?
Small tweaks to "Local variable declarations" #1208
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
[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.1 General starts by saying
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.