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

JSON.parseImmutable as a separate companion proposal #330

Closed
michaelficarra opened this issue Jul 19, 2022 · 5 comments · Fixed by #341
Closed

JSON.parseImmutable as a separate companion proposal #330

michaelficarra opened this issue Jul 19, 2022 · 5 comments · Fixed by #341

Comments

@michaelficarra
Copy link
Member

JSON.parseImmutable seems like it can be expressed as an option given to JSON.parse since it's otherwise identical as far as I'm aware. I see that in #74 it was originally imagined this way but quickly rejected. But couldn't we take an options bag in place of the reviver and branch on its type?

This kind of question is why I'm still a little uneasy about whether JSON.parseImmutable should be pursued as a follow-on proposal or not.

@ljharb
Copy link
Member

ljharb commented Jul 19, 2022

It does seem like a separable piece that would be good in a follow-on proposal.

@nikeee
Copy link
Contributor

nikeee commented Jul 19, 2022

There is also https://github.com/tc39/proposal-json-parse-with-source that might clash with adding a parameter to JSON.parse.

@gibson042
Copy link

That proposal does not change the JSON.parse ( text [ , reviver ] ) signature, just the arguments passed to a reviver function. So it would be possible to add another parameter like JSON.parse ( text [ , reviver [ , options ] ] ), or possibly to overload the second parameter to something like JSON.parse ( text [ , optionsOrReviver ] ) as in Temporal round methods and DOM APIs like addEventListener.

@acutmore
Copy link
Collaborator

acutmore commented Jul 22, 2022

Thanks for raising this. Have just discussed this with @littledan and @rricard. We are happy to split this off as a separate proposal, which will retain the stage 2 status. We can present this at the next plenary.

@acutmore acutmore changed the title is JSON.parseImmutable significantly different enough that it deserves its own API? JSON.parseImmutable as a separate companion proposal Jul 22, 2022
@acutmore
Copy link
Collaborator

acutmore commented Aug 5, 2022

new repo for anyone interested in following there 😀
https://github.com/tc39/proposal-json-parseimmutable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants