-
Notifications
You must be signed in to change notification settings - Fork 18k
strconv: QuotedPrefix documentation ambiguous #46829
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
Comments
CC @dsnet |
For the record, |
It says:
The adjective "quoted" implies that the result still contains the surrounding quotes. If the adjective wasn't there, then it would be ambiguous. I'll add an example, so that it's more obvious what the function does. |
Change https://golang.org/cl/336749 mentions this issue: |
Is this issue waiting for CL336749 to be merged? |
Example can sometimes be more informative than additional prose. Fixes golang#46829 Change-Id: Ia5a5b121ad0b891026e77420d5f7f1b2c4a407da Reviewed-on: https://go-review.googlesource.com/c/go/+/336749 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
What version of Go are you using (
go version
)?1.17 release notes
Does this issue reproduce with the latest release?
arguably no since the latest release, 1.16, does not have this function yet :)
What operating system and processor architecture are you using (
go env
)?N/A
What did you do?
Read release notes and corresponding documentation.
What did you expect to see?
Documentation that I understand.
What did you see instead?
Documentation which confused me.
It is unclear to me whether "as understood by Unquote" means "an initial prefix which Unquote would think was a valid quoted string that it could unquote", or "the result of unquoting such an initial prefix".
For instance, consider the string:
"foo"bar
I would guess that QuotedPrefix, called on this, would yield either
"foo"
orfoo
, but i don't know which; both are "the quoted string (as understood by Unquote)". I think the intent is probably"foo"
, because that seems more likely to be useful -- given the other string, I don't have a way to trim that prefix from the parent string, because I don't know how it looked in the parent string. On the other hand, it seems weird to go to all the trouble of separating it out and parsing it as though unquoting, and not actually do the unquoting, so I don't know.I feel like QuotedPrefix should probably return (prefix string, remainder string, error). I'm less sure about dequoting; the dequoting operation presumably causes allocation. (It'd be neat, though, to be able to inquire as to the length the dequoted string would have...)
The text was updated successfully, but these errors were encountered: