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
> downloading.
>

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.
>
> /be
>
>
>
>
> Corey Richardson wrote:
>
>> They seem rather out-of-place in a language that includes no standard
>> library.
>> I would include RegExp in that list but there is literal syntax for that
>> in
>> the language.
>>
>> Are the reasons purely historical/for convenience of standardization in
>> JavaScript? They seem like something the host environment should provide,
>> not a native object.
>>
>> ______________________________**_________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>>
>>  ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120217/0aa08324/attachment.html>


More information about the es-discuss mailing list