JSON.parse internals hook

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Aug 20 12:43:58 PDT 2013


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?
> 
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=22840
> http://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.

Allen






> 
> -- 
> http://annevankesteren.nl/
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 



More information about the es-discuss mailing list