JSON.parse internals hook

# Anne van Kesteren (11 years ago)

I want to refer to the algorithm JSON.parse defines, but not necessarily JSON.parse itself (as that can be overridden). Is there any preferred way to do that? Or otherwise can JSONParse hook be introduced?

www.w3.org/Bugs/Public/show_bug.cgi?id=22840, xhr.spec.whatwg.org/#json

# Allen Wirfs-Brock (11 years ago)

On Jul 31, 2013, at 7:52 AM, Anne van Kesteren wrote:

I want to refer to the algorithm JSON.parse defines, but not necessarily JSON.parse itself (as that can be overridden). Is there any preferred way to do that? Or otherwise can JSONParse hook be introduced?

www.w3.org/Bugs/Public/show_bug.cgi?id=22840, xhr.spec.whatwg.org/#json-response-entity-body

Simply reference the the appropriate clause of the ES specification that defines the function. EG, "the JSON.parse function defined in clause 15.12.1.2 of Ecma-262 Edition 5.1" (but the clause number is likely going to change for ES6)

Within ES5 we used a phrase like "the standard built-in JSON.parse function" to refer to the specified built-in function rather than the current value of the JSON.parse property.

Within ES6 we will use a formalism like %JSONparse% to mean the something. However, note that this notation means the built-in function as associated with a specific realm. This is important because the algorithm does realm specific things things like allocate objects and initialize their [[Prototype]] with a Realm specific value.