Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upEditorial: Remove unused steps from definitions of Contains #1519
Conversation
... specifically, steps of the form: If _symbol_ is an |Identifier| and StringValue of _symbol_ is the same value as the StringValue of |IdentifierName|, return *true*. Resolves issue #831. As @allenwb points out, the intended use case for such steps does not occur in the spec. And as I point out, these steps are semantically problematic. If the intended use case ever *does* occur, I'm guessing we'll find a different way to handle it.
... after previous commit. Specifically, when code says: ``` 1. If <something>, return *false*. 1. Return *false*. ``` we can drop the first step, because the result is `*false*` either way.
This comment has been minimized.
This comment has been minimized.
Such as introducing a new static semantic rule like "ContainsIdentifier" or somesuch? |
This comment has been minimized.
This comment has been minimized.
Yup, e.g. Or we might try to introduce a form that abstracts over this kind of ContainsFoo operation, so that defining a new one isn't too burdensome. |
This comment has been minimized.
This comment has been minimized.
waldemarhorwat
commented
Jul 23, 2019
Is Contains ever used with identifiers? If not, then it might be better to do the following:
It's currently unclear where Contains stops. Does it jump from the syntactic grammar to the lexical grammar? I hope it doesn't, but the spec is ambiguous. While doing the above it would be good to clarify how Contains deals with that boundary (and on which side of that boundary reserved words and IdentifierName lie) in the definition of Contains. |
This comment has been minimized.
This comment has been minimized.
The right-hand argument of Here are all the right-hand args:
Yeah, I think that would work (assuming the syntactic/lexical boundary isn't a problem, see below).
What do you mean by "reserved words not in IdentifierName"? It seems to me that there's no such thing. (That is, any sequence of characters that matches
I believe it doesn't (currently) matter. That is, for the cases in which it is currently used,
It seems to me that the spec prefers to avoid talking about that boundary. Which might be one reason that these rules stop the recursion one step away from it. |
jmdyck commentedApr 26, 2019
•
edited by ljharb
... specifically, steps of the form:
Resolves #831.
As @allenwb points out, the intended use case for such steps does not occur in the spec.
And as I point out, these steps are semantically problematic.
If the intended use case ever does occur, I suspect we'll find a different way to handle it.