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

proposal: strconv: export unquote and appendQuotedWith #51887

Closed
oakad opened this issue Mar 23, 2022 · 8 comments
Closed

proposal: strconv: export unquote and appendQuotedWith #51887

oakad opened this issue Mar 23, 2022 · 8 comments

Comments

@oakad
Copy link

oakad commented Mar 23, 2022

Follow up to #45033

There's a perfectly good function in the strconv package called unquote. unquote does things most text parsing applications need. Instead of making it public, per the original proposal, we've got the totally superfluous QuotedPrefix, which requires us to parse the source string twice.

Moreover, appendQuotedWith is a really useful companion function and should be made public as well.

@oakad oakad added the Proposal label Mar 23, 2022
@bradfitz
Copy link
Contributor

So what's the proposal?

@ianlancetaylor ianlancetaylor added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed Proposal labels Mar 23, 2022
@oakad
Copy link
Author

oakad commented Mar 24, 2022

Make strconv.unquote and strconv.appendQuotedWith public, of course. Possibly with slightly different names.

@ianlancetaylor ianlancetaylor changed the title strconv.QuotedPrefix is pessimization and all the various strconv.appendQuotedWith wrappers are as well proposal: strconv: export unquote and appendQuotedWith Mar 24, 2022
@gopherbot gopherbot added this to the Proposal milestone Mar 24, 2022
@ianlancetaylor
Copy link
Contributor

CC @dsnet

@ianlancetaylor ianlancetaylor added Proposal and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 24, 2022
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Mar 25, 2022
@ghost
Copy link

ghost commented Apr 18, 2022

the appendQuotedWith family of functions being exposed would have saved me a few workdays in 2020. IIRC we had to fork and re-export the relevant parts of strconv.

@rsc
Copy link
Contributor

rsc commented May 25, 2022

We had this discussion on #45033 and decided not to export unquote. I don't see any new evidence here.

@oakad
Copy link
Author

oakad commented May 26, 2022

"You don't always want to parse it, but you always need to identify a boundary."

Really?
Not a single time in my not particularly short career I wanted to find out the boundary without also unescaping the string into a usable form (if only for debugging print out). :-)

For whatever reason, various data mining setups still rely very strongly on CSV style files. Huge CSV style files, where there are many strings, escapes abundant and fields are separated by a single ascii codepoint.

By providing a crippled API in the runtime, you're basically saying: don't use it, just go for third-party/self implemented solution. Yep, that's what we do all the time.

But then, why pollute the runtime with useless things?

@rsc rsc moved this from Incoming to Likely Decline in Proposals (old) Jun 1, 2022
@rsc
Copy link
Contributor

rsc commented Jun 1, 2022

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@rsc rsc moved this from Likely Decline to Declined in Proposals (old) Jun 8, 2022
@rsc
Copy link
Contributor

rsc commented Jun 8, 2022

No change in consensus, so declined.
— rsc for the proposal review group

@rsc rsc closed this as completed Jun 8, 2022
@golang golang locked and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

5 participants