:label
supports Civet reserved words (but not JS reserved words)
#1641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1638
:label
loop
andand
are useful:void
remains untouched for possible return type annotation...break :label
can also use a reserved word, with the same caveatsbreak loop
also works likebreak :loop
, because it's "natural" meaningwhile (true) break
isn't useful.It's debatable to me whether
:void
should be allowed as a return-type annotation. It's extremely fragile; for example,:number
doesn't work as a return-type annotation at the beginning of a line (it's treated as a label). UPDATE: But I guess:void
is common enough to be worth keeping.We could allow JavaScript reserved words in
:label
(possibly excepting:void
) by transpiling them to_label:
(though we need to avoid conflicts here, and can't exactly use refs). I'm not sure how useful this would be. But it might be nice e.g. to write