Unicode em- and en-dashes in godocs?

324 views
Skip to first unread message

Matthew Dempsky

unread,
Jul 24, 2015, 2:07:57 AM7/24/15
to golang-dev
I noticed a handful of hyphens and double-hyphens in godocs where typical English style guides would advise using em- or en-dashes instead.  Is it worth changing them to use Unicode dashes, or is that just make-work?

There's precedent for using Unicode dashes in internal comments and the HTML documentation, and for using other Unicode characters in godocs as appropriate.

debug/elf:
        SHN_XINDEX    SectionIndex = 0xffff /* Escape -- index stored elsewhere. */

mime/multipart:
        contain certain ASCII characters, and must be 1-69 bytes long.

net:
        the mask is not in the canonical form--ones followed by zeros--then Size

net/http:
        Write writes an HTTP/1.1 request -- header and body -- in wire format.

text/template:
        "Actions"--data evaluations or control structures--are delimited by "{{"

Aram Hăvărneanu

unread,
Jul 24, 2015, 1:27:24 PM7/24/15
to Matthew Dempsky, golang-dev
Apologies, but I don't understand your proposal/question. To me, it
can be about one of these three things:

1) changing the comments
2) making godoc synthesise unicode dashes in the browser
3) making godoc (or go doc?) synthesise unicode dashes in the terminal

--
Aram Hăvărneanu

Matthew Dempsky

unread,
Jul 24, 2015, 1:41:30 PM7/24/15
to Aram Hăvărneanu, golang-dev
Changing the source comments to use "—" or "–" as stylistically appropriate instead of "--" or "-".  E.g., changing src/text/template/doc.go:19 to:

        "Actions"—data evaluations or control structures—are delimited by "{{"

Nigel Tao

unread,
Jul 27, 2015, 1:49:24 AM7/27/15
to Matthew Dempsky, Rob 'Commander' Pike, golang-dev
On Fri, Jul 24, 2015 at 4:07 PM, 'Matthew Dempsky' via golang-dev
<golan...@googlegroups.com> wrote:
> I noticed a handful of hyphens and double-hyphens in godocs where typical
> English style guides would advise using em- or en-dashes instead. Is it
> worth changing them to use Unicode dashes, or is that just make-work?

I feel like it's make-work, but will defer to r for any documentation
bikeshedding.

Rob Pike

unread,
Jul 27, 2015, 2:12:39 AM7/27/15
to Nigel Tao, Matthew Dempsky, golang-dev
If you want to do the work, I will review the results. If you don't
want to do the work, I won't bother.

-rob

Matthew Dempsky

unread,
Jul 27, 2015, 10:51:32 PM7/27/15
to Rob Pike, Nigel Tao, golang-dev
My take away from golang.org/cl/12683: em- and en-dash, while technically correct, are not the best kind of correct, because they make fixed-width presentations harder to read.  Instead, continue to use double hyphens without spaces in lieu of em-dashes, but favor simpler syntax where possible.

Russ Cox

unread,
Jul 27, 2015, 10:57:20 PM7/27/15
to Matthew Dempsky, Rob Pike, Nigel Tao, golang-dev
On Mon, Jul 27, 2015 at 10:51 PM, 'Matthew Dempsky' via golang-dev <golan...@googlegroups.com> wrote:
My take away from golang.org/cl/12683: em- and en-dash, while technically correct, are not the best kind of correct, because they make fixed-width presentations harder to read.  Instead, continue to use double hyphens without spaces in lieu of em-dashes, but favor simpler syntax where possible.

I'm sorry, but I disagree. It is perfectly fine to use em dashes, and they are preferable to typing "--", which smacks of ASCII art. There are already em dashes in the docs for the standard library. Please do not take them out.

Russ

Matthew Dempsky

unread,
Jul 27, 2015, 11:52:39 PM7/27/15
to Russ Cox, Rob Pike, Nigel Tao, golang-dev
I have to defer to Rob.  My "take away" was not meant to advocate a solution, but instead as a summary of how I plan to write standard library documentation in the future based on his code review feedback.

I primarily read Go documentation in a variable-width font, so my personal preference would still be to use em and en dashes instead of "--".  But I do agree with Rob that fixed-width presentations (particularly Gerrit) make them difficult to distinguish from hyphens.

Lastly, for what it's worth, golang.org/cl/12683 did not remove any em dashes.  It only replaced hyphens and double hyphens.

Rob Pike

unread,
Jul 28, 2015, 1:27:23 AM7/28/15
to Matthew Dempsky, Russ Cox, Nigel Tao, golang-dev
In Gerrit, the em dashes were indistinguishable from dashes, which led
to significant ambiguity.

-rob
Reply all
Reply to author
Forward
0 new messages