"use subset" introductory material

Mark S. Miller erights at google.com
Mon Jun 30 21:08:07 PDT 2008


On Mon, Jun 30, 2008 at 7:37 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> JSON be handled with a generic subset mechanism? I expect not, since a
> pragma inside the JSON source in the form of an initial quoted string would
> be (a) invalid JSON and (b) ineffective as a way to validate incoming JSON,
> since malicious alleged JSON would not use such a pragma.

Whether or not it's a good idea, given "use subset JSON" as a
recognized/enforced subset directive, one could trivially implement
JSON.stringify(str) in terms of

    eval('"use subset JSON"; (' + str + ')')

> I do think JSON should be supported natively, but it does not seem at all
> analogous to strict mode / cautious subset.

I think I agree. In any case, I agree that JSON is not by itself a
compelling case for "use subset X". My point is only that JSON is a
huge counter-example to Brendan's statement that "profiled (subsetted)
standards are meaningless to harmful on the web". JSON was defined as
an enforced subset of JavaScript, and it has been extraordinarily
helpful to the web.


More information about the Es4-discuss mailing list