Skip to content
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

go/doc: reconsider comment rewrites of '' to #54312

Open
kortschak opened this issue Aug 6, 2022 · 5 comments
Open

go/doc: reconsider comment rewrites of '' to #54312

kortschak opened this issue Aug 6, 2022 · 5 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@kortschak
Copy link
Contributor

kortschak commented Aug 6, 2022

In ae3d890 as part of addressing #51082, a change was made to go/doc that rewrite all '' to . This makes semantic changes to comments where ' is used as a prime and '' is used as double prime, common in mathematical code.

This was raised in #51082 (comment) but essentially disregarded. A work around was suggested,

as a workaround, you could replace those with U+2032 PRIME and U+2033 DOUBLE PRIME. That is, f'f′ and f''f″. (Those may look the same depending on your font.)

However on investigation with relevant fonts (the font here and the font used by pkg.go.dev) at 100%, U+2033 DOUBLE PRIME is barely distinguishable from U+2032 PRIME and worse, also barely distinguishable from other commonly used marks in the same position such as '*' (Comparison: f′ f″ f* ).

The change has made it harder to read these comments, harder to write them in a way that doesn't get mutated and easier for incorrectly formatted comments to be committed (f'' getting mutated to f” which is essentially indistinguishable from f″ at normal font sizes).

@mvdan
Copy link
Member

mvdan commented Aug 6, 2022

f'' getting mutated to f” which is essentially indistinguishable from f″ at normal font sizes

I had to put my glasses on to see the difference at my regular zoom level, so I think you're right :) And this is on a 25" monitor, let alone a tiny phone screen.

@seankhliao seankhliao added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Aug 6, 2022
@seankhliao
Copy link
Member

cc @rsc

@zikaeroh
Copy link
Contributor

zikaeroh commented Aug 6, 2022

Another example is when docs refer to the empty string, specifically JS where strings aren't necessarily double quoted, leading to undesirable doc replacements (and apparently, inserting quotes at the start/end of paragraphs that are not quotes?) as in: evanw/esbuild@296870e

@ALTree
Copy link
Member

ALTree commented Oct 22, 2022

An example from #56380 (unable to write '' in a comment, closed as a dup of this one):

Since Go 1.19 (commit ae3d890) '' is unconditionally transformed to or . This means my comment:

// lexMultilineRawString consumes a raw string. Nothing can be escaped in such
// a string. It assumes that the beginning ''' has already been consumed and
// ignored.

Now becomes:

// lexMultilineRawString consumes a raw string. Nothing can be escaped in such
// a string. It assumes that the beginning ”' has already been consumed and
// ignored.

There are some other cases, especially when parsing things, where one might reasonably want to type '' inside a regular (non-codeblock) comment.

Looking at go/doc/comment/parse.go, there is no way to escape this behaviour, and I don't really see an obvious non-ugly way to write that comment.

@evanw
Copy link

evanw commented Dec 8, 2022

I recently encountered a particularly annoying case of this behavior. I wanted to write this:

quoteChar should be either '"' or '\''

But no matter what I do, it keeps being turned into this:

quoteChar should be either '"' or '\”

This replacement makes no sense, and is not helpful at all. Really hoping this behavior can be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants