On 2015-02-02 09:46, Brendan Eich wrote:
> That was simply for consonance with the other productions reached directly > from the Statement nonterminal. That is my actual question: Was there a specific reason to make it a /Statement/ as opposed to something similar like /FunctionDeclaration/, which is not a /Statement/? > Mostly because /VariableStatement/ is allowed in all statement contexts > (including the then and else clauses of if statements) while /Declaration/ is > only allowed in contexts that require a list of statements and declarations. That I understand. Sorry if I wasn't able to express my question clearly, let me try it again: Before ES6, there was basically just one construct that wasn't a /Statement/, namely /FunctionDeclaration/. Now with ES6, `let` and `const` have been introduced, but not as /Statement/s (like `var`), but as /Declaration/s. I assume there is a reason for that? /FunctionDeclaration/ was added to /Declarations/ as well (that one is obvious). That made me wonder why /VariableStatement/ was a /Statement/ to begin with? Maybe the concept of a "declaration" wasn't really developed back then, but then what was the reasoning for /FunctionDeclaration/ not being a /Statement/ (was it even part of ES1? I don't know) ? I would accept the answer "because Brendan had to develop the language in such a short time and that's just the way he did it" ;)
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss