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

Language for testing the state of a production parameter is inconsistent #2568

Open
gibson042 opened this issue Nov 4, 2021 · 2 comments
Open

Comments

@gibson042
Copy link
Contributor

Description:
A handful of sections test the state of production parameters, but they do so inconsistently. We should pick one pattern and standardize on it.

https://tc39.es/ecma262/#sec-identifiers-static-semantics-early-errors and https://tc39.es/ecma262/#sec-patterns-static-semantics-early-errors-annexb

  • "if this production has a […] parameter"

https://tc39.es/ecma262/#sec-static-semantics-template-early-errors

  • "if the […] parameter was not set"

https://tc39.es/ecma262/#sec-async-function-definitions and https://tc39.es/ecma262/#sec-regular-expressions-patterns

  • "when the […] parameter is {present,absent}"
  • "with the […] parameter present on [symbol]"
@jmdyck
Copy link
Collaborator

jmdyck commented Nov 4, 2021

If you look at a parameterized production, such as:

StatementList[Return, In] : ...

and think of it as an abbreviation for 4 different productions:

StatementList : ...
StatementList_Return : ...
StatementList_In : ...
StatementList_Return_In : ...

then phrases such as "if this production has a [Return] parameter" or "if the [Return] parameter is present/absent" kind of make sense: you can think of it as "if this production's LHS has _Return in its name".

However, my guess is, most people don't think of it that way, they think of it as a production with parameters. In which case, these phrases are odd: you look at the production and it clearly has a [Return] parameter (the [Return] parameter is present), so how can it be a question of "if"?

So I think we should eliminate the phrasings:

  • "if this production has a […] parameter"
  • "when the […] parameter is {present,absent}"
  • "with the […] parameter present on [symbol]"

That leaves

  • "if the […] parameter was not set"

which is okay, but 5.1.5 Grammar Notation should clarify that (roughly speaking) "set" = "+" and "not set" = "~".

@gibson042
Copy link
Contributor Author

Related: #2236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants