golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.94k stars 17.66k forks source link

all: inconsistent hyphenation #21327

Open josharian opened 7 years ago

josharian commented 7 years ago

Grepping for //.*[a-zA-Z]-\n (see CL 53510) yields some examples of phrases that are inconsistently hyphenated in the tree. Two prominent ones:

Low priority, but we should pick one and use it consistently. (And also do a more targeted grep to find other hyphenation inconsistencies.)

bcmills commented 7 years ago

We should also be consistent about how to punctuate em-dashes: we currently have a mix of two or three hyphens, with or without AP-style spaces.

The typographically-correct thing to do would be to use u+2014 (em dash) consistently, in which case I would suggest also using spaces: many editors render an em-dash as a single-width character in fixed-width fonts, so a single em dash without spaces often appears too narrow.

(But even if we don't use the em dash, we should be consistent about spacing.)

bcmills commented 7 years ago

Finally, should we use typographically-correct en dashes instead of hyphens for things like algorithms (Miller–Rabin), ranges (a–z, 0–9, R7–R25), and contrasting compounds (Child–Sibling order)?

(http://www.thepunctuationguide.com/hyphen-and-dashes.html is a great reference on the various dashes and their usage.)

josharian commented 7 years ago

should we use typographically-correct en dashes instead of hyphens

Yes!

a single em dash without spaces often appears too narrow

That's a pity, but em dashes are properly used without spaces.

(But even if we don't use the em dash, we should be consistent about spacing.)

Yes, please.

On the en/em dash front, an alternative is to use two or three hypens and teach godoc to combine them. But I'd rather just use the rune to begin with.

(I just started pondered writing a tool to reflow comments, using some heuristics to trade off between semantic line breaks, reasonable line length, consistent line length, and punctuation niceties...and decided to beat a hasty retreat. It would be kind of awesome for Go to be the language with the best automated comment layout engine, though.)

ghost commented 7 years ago

Another one to add to the list is UTF-8 encoded vs. UTF-8-encoded.

bcmills commented 6 years ago

@bontibon I don't think there is a hard-and-fast rule for compound adjectives.

I would tend to use “UTF-8 encoded” as a predicate adjective, as in “If the text is UTF-8 encoded, …”, but “UTF-8-encoded” as an ordinary adjective, as in “For UTF-8-encoded text, …”. However, in the latter case I would almost always look for a less awkward way to write the sentence, for example, “For text encoded in UTF-8, …”.

rsc commented 6 years ago

Low priority, but we should pick one and use it consistently.

This is not true. "run time" is a noun; "run-time" is an adjective. "Run-time initialization happens at run time." (This is a rule of English, not of Go documentation.)