-
Notifications
You must be signed in to change notification settings - Fork 287
Some work on py-nutshell.rakudoc #4698
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
base: main
Are you sure you want to change the base?
Conversation
doc/Language/py-nutshell.rakudoc
Outdated
| my $bar = 19; # both at once | ||
|
|
||
| Also, as you may have noticed, variables in Raku usually start with sigils -- | ||
| Also, as you may have noticed, variables in Raku usually start with sigils – |
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.
here I replaced two dashes (rendered as two dashes) by an en dash
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.
Wouldn't an em-dash be more appropriate here?
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.
I'm not sure.
Current factual usage in the docs is about evenly split between spaced en dashes and unspaced em dashes. (For the convenience of anyone wanting to check with a ripgrep: – and — )
The Wikipedia style says both are fine, just keep it consistent within a given article.
The Chicago Manual of Style and also a guide on technical writing do agree that unspaced em dashes should be used.
However, the text of the Raku docs is not being rendered via LaTeX or any other print-focused typesetting system, but instead (for most people) on the website and (for some people) in the rakudoc CLI tool.
- On the website, unspaced em dashes don't work so well with padded inline code, of which we have a lot. For example, take a look at the bottom of this section.
- In a CLI tool, with a monospace font, unspaced dashes are also problematic.
How others do it:
- The Python docs seem to consistently use spaced em dashes.
- The Ruby docs use em dashes, but very sparingly and not consistenly with regard to spacing
- The git man pages use em dashes. It seems like they prefer spaced ones (e.g. man git, man gitcli, man gitcore-tutorial, man git-blame), but some unspaced ones occur here and there (man gittutorial).
Personally I now tend toward using spaced em dashes, especially because of all the padded inline code on docs.raku.org, and because of the CLI. However, it's probably best if there's a consensus which one can then put into the styleguide.
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.
My understanding is that the en dash has three particular use cases that call for it, and that this context isn't one of those.
https://en.wikipedia.org/wiki/Dash#En_dash says
The three main uses of the en dash are:
- to connect symmetric items, such as the two ends of a range or two competitors or alternatives
- to contrast values or illustrate a relationship between two things
- to compound attributes, where one of the connected items is itself a compound
To offset a parenthetical remark, as here, an em dash is called for. I have no opinions about the whitespace; from what you say, it sounds as if it would work better with spaces around it.
If any of those en dashes that you found in the current docs are not examples of one of the three use cases mentioned above, they probably ought to be changed to em dashes.
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.
Since wikipedia says either, and the Tribune picks one, I’m happy to make that one the recommendation, add a style test for it, and then make sure we pass the test (and also add it to the styleguide) - Let’s move that into a new ticket and whatever we end up with for this PR is fine, we’ll fix it in post if we have to.
| return a + b | ||
| =end code | ||
|
|
||
| =begin code |
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.
Why split this code up?
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.
The intention was to have Python code and Raku code apart like elsewhere in the document to emphasize the shift in language (and to not have Raku code in a block marked as "Python highlighting"). But the example does work well the way it is, perhaps even better, so yes I think I'll revert it (and probably add comments # Python and # Raku to the right of each signature).
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.
Oh, I hadn’t even noticed they were not the same language - in that case, sorry, please separate them AND tag each with the right language attribute - the more raku code we can verify the better
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.
Ah, I see – I've done that now
This will partly address issue #2354.
Note to self:
Add a rudimentary section on Raku's type system below the section on variables.
In this new section, include among other things the distinction between definite and indefinite objects.
In the section "Control flow", include (a little bit) of material on
givenand//– mostly to show what would be Raku equivalents of the common Python idiomif x is not None. Perhaps split the control flow section into the two subsections "Conditionals" (if, given, when...) and "Iteration" (while, for, loop...).