-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
close #18092 document elif in case statements #18105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
alaviss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also document that elif have to come after of. The manual is the language specification so we would want these details documented.
|
done |
|
While this technically documents "elif" in case statements (and is an improvement), I feel that there should be some additional explanation. Before this PR, I wasn't even aware that From the example, appears that |
|
i feel it's clear enough and un-ambiguous as written, but feel free to suggest an alternative wording as code review comment.
exactly what you wrote:
within a case statement, yes |
|
The code example is not the spec, it's... an example. We already have a decent amount of writing right below it, and I think we should expand the paragraph talking about |
yes and no; in this case I agree (and have updated spec description), but in other cases (in particular description of edge cases in APIs) it may makes sense to treat examples as spec because the alternative would be both non-DRY and add no value for readers compared to a well written (and compiler checked) runnableExamples. I also mentioned the special case of string and mentioned the spec might change (refs #11474 (comment)) |
|
The behavior an example describes tends to be implicit - my previous comment on elif's behavior was a guess. If not repeating information is a priority here, it would be preferable to go with an explicit description of elif's behavior over an implicit example. |
|
The spec should say something like: "elif" in "case" is handled just like "else: if". |
7955470 to
e4adcca
Compare
|
PTAL |
* close nim-lang#18092 [skip ci] document elif in case statements * fixup * clarify spec; mention special rule for string in case statements * address comments
close #18092