> Le 9 oct. 2013 à 18:46, Oliver Hunt <[email protected]> a écrit :
> 
> 
>> On Oct 9, 2013, at 1:35 AM, Claude Pache <[email protected]> wrote:
>> 
>> 
>>> Le 8 oct. 2013 à 23:43, Andrew Fedoniouk <[email protected]> a 
>>> écrit :
>>> 
>>> Quite often Date values are used in data exchanges in form of JS
>>> literals or JSON.
>>> 
>>> It would be beneficial if JS (and JSON as derivative) will have an
>>> ability to represent dates literally  . For example:
>> 
>> Even if there had been a dedicated syntax to write literal dates in JS, it 
>> doesn't mean that JSON would have allowed such a representation.
>> For instance, the following entities have literal representation in JS, but 
>> do not exist in JSON, by the will of its designer: Infinity, NaN, and 
>> regular expressions.
> 
> Infinity and NaN a identifiers referencing properties on the global object — 
> they’re not literals (nor is undefined).
> 
> These are all valid (but you shouldn’t do it):
> 
> function f(undefined, NaN, Infinity) {
> // dooooooommmmmm
> }
> 
> 
> function f() {
> var undefined = null /* fix that silly null vs. undefined shenanigans */, NaN 
> = Math.sqrt(2) /* make sure nan is not rational */, Infinity = 10000000 /* 
> this should be big enough */
> }
> 
> —Oliver

Yes, I know... Well, the next time, I will avoid to do an oversimplification in 
order to make my point, for there is always someone for splitting hairs. 
(Hopefully, RegExp literals remain. And I left as an exercise to the reader to 
understand what happens to -0 when transiting through JSON, and why... No, I 
won't discuss the answer.)

—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to