Why do JSON, Date, and Math exist?
Mark S. Miller
erights at google.com
Fri Feb 17 16:35:34 PST 2012
On Fri, Feb 17, 2012 at 3:39 PM, Brendan Eich <brendan at mozilla.org> wrote:
> JS1 in 1995 needed *some* batteries included: Date, Math functions. I
> chose java.util.Date (implementation, this was the one piece I had help on
> from Ken Smith of Netscape, was a port from Java to C) and java.lang.Math.
> JSON is more recent but again we want some batteries included, especially
> for the browser JS embedding. Downloading requires provisioning and hurts
> page load performance (pay for what you use but it's still a big-enough
> cost). JSON is based on Doug Crockford's json2.js which people were in fact
And json2.js was a complex set of RegExps guarding an eval. These RegExps
were too complicated for anyone, including Crock, to have confidence that
the result was secure. This was a security emergency waiting to happen.
> You could argue JSON didn't need to be in the core language. We did it,
> it's not worth revisiting. But the ES6 module system should help us avoid
> yet more such global namespace-object additions.
> Corey Richardson wrote:
>> They seem rather out-of-place in a language that includes no standard
>> I would include RegExp in that list but there is literal syntax for that
>> the language.
>> Are the reasons purely historical/for convenience of standardization in
>> not a native object.
>> es-discuss mailing list
>> es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss