This proposes a change in presentation with no normative effect.
For readers, the existence of the Keyword nonterminal is suggestive. It sounds like it's a category that means something, that these 34 words have some syntactic property in common that is not also shared by other words like static and let.
But they don't. The word "keyword" appears 18 times in the current draft, but its only normative use is to include the Keyword list in the ReservedWord list. This really set me on the wrong track; I felt misled by the spec.
So I propose defining ReservedWord by listing all the reserved words, and removing Keyword and FutureReservedWord, to simplify the spec.
Could we perhaps instead remove the "reserved word" terminology and call them all keywords?
Or that.
English-wise, "reserved word" sounds more correct than "keyword", given that some of them are not "key" to anything in ES, so given that this proposed change is entirely about clarity, I prefer @jorendorff's initial proposal.
Google's first definition result for "keyword definition programming" is "a keyword is a word that is reserved by a program because the word has a special meaning", so both seem correct; it seems to me like more people colloquially refer to them as keywords than as reserved words.
Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the language.
https://stackoverflow.com/questions/1078908/what-is-the-difference-between-keyword-and-reserved-word
Well, I think that definition from Google is conflating the meanings of "keyword" and "reserved word". A language may have "keywords (ie, words that have a special meaning, perhaps contextually) and "reserved words" whose use the language reserves for its exclusive use. That a word is a "keyword" does not necessarily imply that it is "reserved".
For example, in modern JS let is contextually a keyword that starts a specific declaration form. It is not "reserved" for that exclusive use as it may also be used as an identifier. var is a reserved word. It too is a keyword that starts a specific declaration form but it is "reserved" for that exclusive use.
In general in JS a "reserved" word is one that cannot be used as user defined bound identifier. That distinction is partially modal based upon strict mode. Of course, these are really conceptual distinctions that are must useful to people trying to learn or understanding the language. Grammar symbols used in productions that specify these behaviors could use gibberish names.
@allenwb so is your suggestion to leave things as they are, given that keywords and reserved words aren鈥檛 the same thing?
Is there an actual significant problem the change would address? Perhyaps, something new that needs to be expressed that the current formulation interferes with? If not, why is anybody worrying about it.
The OP suggests making a change would reduce confusion.
It's worth mentioning that "keyword" and "reserved word" are not just terms made up for ecma262, they have meaning in computer science, so i think it makes sense to use them.
This issue is about the Keyword grammar symbol.
I endorse @allenwb's definitions of "keyword" and "reserved word". In fact that's why Keyword should be deleted. The problem is that Keyword does not mean "keyword".
Also, it's unused.
The initial post explains further.
Most helpful comment
Well, I think that definition from Google is conflating the meanings of "keyword" and "reserved word". A language may have "keywords (ie, words that have a special meaning, perhaps contextually) and "reserved words" whose use the language reserves for its exclusive use. That a word is a "keyword" does not necessarily imply that it is "reserved".
For example, in modern JS
letis contextually a keyword that starts a specific declaration form. It is not "reserved" for that exclusive use as it may also be used as an identifier.varis a reserved word. It too is a keyword that starts a specific declaration form but it is "reserved" for that exclusive use.In general in JS a "reserved" word is one that cannot be used as user defined bound identifier. That distinction is partially modal based upon strict mode. Of course, these are really conceptual distinctions that are must useful to people trying to learn or understanding the language. Grammar symbols used in productions that specify these behaviors could use gibberish names.