JSON text is not a subset of PrimaryExpression

Mark Miller erights at gmail.com
Wed Jul 19 17:09:41 UTC 2017


Hi Allen, that one word change would correct the inconsistency. I agree
that it is the most that is likely to happen. I would prefer that we
actually fix JS so that it is a superset of JSON, as I preferred during our
es3.1 days. However, I agree that this is
    a) even less likely to happen now than it was then, and
    b) matters less now than it would have then, since no one has any
remaining excuse for using eval to parse JSON.
Assuming that we are in fact stuck, I agree that we should make that one
word change.

Nevertheless, I would still prefer that we fix JS so that it is a superset
of JSON. I can't say that I care a lot. But if someone does, it would be
good if they could gather statistics on how much existing JS code would
break. Simply scanning for the total number of *.js files in github that
contain a literal \u2028 or \u2029 would give a nice upper bound on that. I
suspect that even this upper bound would be shockingly tiny; but I do not
actually know.



On Wed, Jul 19, 2017 at 9:40 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Jul 18, 2017, at 9:36 PM, Mark S. Miller <erights at google.com> wrote:
>
> I argued for that in the old es3.1 days. IIRC so did Mike Samuel and
> Crock. The pain of doing it now would be higher than it would have been
> then. Nevertheless, I would still be in favor.
>
>
> Why do we care?  ECMAScript and JSON are two distinct languages with their
> own distinct and standardized definitions. And we should be well past the
> time where JS eval is considered to be an acceptable way to process an
> alleged JSON text.
>
> The “issue” raised is one word in a *non-normative paragraph*.  It can be
> corrected with a one word change.  Replace
>
> "Valid JSON text is a subset of the ECMAScript *PrimaryExpression* syntax
> as modified by Step 4 above.”
>
> with
>
> "Valid JSON text is a variant of the ECMAScript *PrimaryExpression*
> syntax as modified by Step 4 above.”
>
> (note that the second sentence of this paragraph is important in that it
> further clarifies that the validity of a JSON text is defined by ECMA-404)
>
> I don’t see such a trivial issue would motivate us start making normative
> changes to either standard when run the risk that such changes would
> opening the door for other proposal to “fix JSON” in some manner or another.
>
> Allen
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> 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/20170719/4e04609f/attachment.html>


More information about the es-discuss mailing list