You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to language docs, it doesn't include any reserved words, so it should compile… but instead it generates an outright confusing syntax error: Parse error on line 1: Unexpected ','
After some fiddling, we narrow down the reason to the match word… But it wasn't used anywhere in the language, was it now?
We do a text search on the language webpage, just in case we forgot about it… And it does find a mention – but only in the changelog, as an experimental feature. So what, was it added but then removed later and they forgot to exclude it from the parser? Nope – after searching through the github issues we find out that the feature is present in the language, just never mentioned anywhere in the docs.
The problem here, of course, is that the match keyword is neither documented in the language docs – not even as a reserved word – nor does its usage produce a sensible error message (when used as an argument name).
Thus, I suggest doing one or more of the following:
Add the full list of reserved words to the language docs, preferably somewhere in the beginning
Exclude the experimental/undocumented syntax from release builds of the parser
Detect when a reserved word is used as a function argument name and generate the error message accordingly (so that the programmer doesn't have trouble figuring out what went wrong when encountering it)
The text was updated successfully, but these errors were encountered:
The fourth option would be quite nice but I think we're limited by the parser generator we're using; Jison's error recovery facilities are... not great.
The third option is something I'm reluctant to do in a keep-the-lights-on context, so unless LiveScript starts gathering forward momentum again, I think experimental match is here to stay.
So that leaves the other two. I've suggested before that a glossary of keywords/symbols would be a good idea, and I still think so; maybe just a list of keywords is worth adding as an interim solution.
Suppose we have the following code:
According to language docs, it doesn't include any reserved words, so it should compile… but instead it generates an outright confusing syntax error:
Parse error on line 1: Unexpected ','
After some fiddling, we narrow down the reason to the
match
word… But it wasn't used anywhere in the language, was it now?We do a text search on the language webpage, just in case we forgot about it… And it does find a mention – but only in the changelog, as an experimental feature. So what, was it added but then removed later and they forgot to exclude it from the parser? Nope – after searching through the github issues we find out that the feature is present in the language, just never mentioned anywhere in the docs.
The problem here, of course, is that the
match
keyword is neither documented in the language docs – not even as a reserved word – nor does its usage produce a sensible error message (when used as an argument name).Thus, I suggest doing one or more of the following:
match
feature to the language docs, possibly in a section named “Experimental features” (Missing documentation for match statement #936)The text was updated successfully, but these errors were encountered: