-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Expose initial JSON.parse as %JSONParse% #1012
Comments
I missed that %JSON% already exists. Could I write something like
then? |
I'd prefer we just name the intrinsic so you can call it directly. |
With the Invoke, you'd be calling whatever I happened to install on the JSON object under "parse"; it definitely would need a direct name. |
Thanks, I'll work on a PR. How would I end up using it in prose afterwards? Just
or something more involved? |
That seems right to me! |
No, that's not correct. That's only correct if it's an abstract operation ("JSONParse", no %s), which indeed is neater. If we expose it as a named intrinsic, we'd need
I think an abstract operation would be nicer if we can get away with it. If we do that we can also make it encompass only steps 2-6 of the JSON.parse function. |
* Add %JSONParse% for Fetch et al Fixes #1012. * add <dfn>
Okay, I think we can just add an abstraction in Infra to make the difficulty go away for everyone else in the web platform. (And maybe also require UTF-8 there at the same time when the input is bytes.) |
That way Fetch and XMLHttpRequest can use it more directly (and other web platform entry points that need JSON parsing). Alternative is an abstract operation, which might be a little clearer usage wise.
Any preference?
The text was updated successfully, but these errors were encountered: