JSON parser grammar

Mark S. Miller erights at google.com
Wed Jun 23 14:22:50 PDT 2010


On Wed, Jun 23, 2010 at 12:11 PM, Brendan Eich <brendan at mozilla.com> wrote:

>
> On Jun 23, 2010, at 8:17 AM, Mark S. Miller wrote:
>
> On Tue, Jun 22, 2010 at 8:17 PM, Dean Landolt <dean at deanlandolt.com>wrote:
>
>> I know many of us in the ES community tend to prefer a Postel's Law
>> approach -- and as long as tabs are always properly stringified it's not a
>> huge interop problem. Still, an argument could be made that with browsers
>> accepting known-bad input (per the JSON spec) it
>> could encourage fragmentation (albeit it minor) of the one format that's
>> really delivered on the promise of true interoperability.
>>
>
> Yes. On the web, as the sorry history of browsers shows too clearly, Eich's
> law may be the more relevant one:
>
> From Dave Herman's blog at <
> http://calculist.blogspot.com/2010/02/eichs-law.html>:
>
> Found this gem in a C++ comment while digging in the SpiderMonkey codebase<http://mxr.mozilla.org/mozilla-central/source/js/src/jsscan.cpp#1464>
> :
>
> After much testing, it's clear that Postel's advice to protocol designers
> ("be liberal in what you accept, and conservative in what you send") invites
> a natural-law repercussion for JS as "protocol":
>
> "If you are liberal in what you accept, others will utterly fail to be
> conservative in what they send."
>
> The comment is unsigned, but it sounds like Brendan.
>
>
> I still think the Robustness Principle in full [1] is worth upholding.
> Validation, especially in developer facing modes or tools (error consoles,
> debuggers), is important.
>
> But tardy validation that annoys users by trying in vain to repeal a
> de-facto standard is worse than pointless. You don't get a second chance
> (dherman's blog post cites a comment I wrote about how <!-- comments,
> treated by JS in browsers as single-line comments, leak from inline script
> content into out-of-line .js files). And browser vendors will not risk
> losing market share on quixotic quests.
>
> Nevertheless, if we can ban TAB per the ES5 JSON spec, let's do it.
> SpiderMonkey currently allows it as noted, but someone will file a bug (if
> it's not already on file).
>

Done:
https://bugzilla.mozilla.org/show_bug.cgi?id=574153
http://code.google.com/p/v8/issues/detail?id=751
https://bugs.webkit.org/show_bug.cgi?id=41102




>
> I don't know whether TABs are an issue in the field that could make
> browsers playing the Prisoner's Dilemma defect from that spec. It is
> possible, since as Ollie notes so many extant JSON implementations allow
> them. OTOH TABs are rare in my experience. Worth discussing and (what would
> be much more useful) field testing. IE9 is head on that front.
>
> But I hate tab characters, so I'm rooting for the home team here ;-).
>
> /be
>
> [1] http://en.wikipedia.org/wiki/Robustness_principle
>



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


More information about the es-discuss mailing list