Open LeXofLeviafan opened 3 years ago
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” (#936)