JSON Duplicate Keys

Brendan Eich brendan at mozilla.com
Fri Jun 7 04:13:25 PDT 2013


Allen Wirfs-Brock wrote:
> The ES5 spec. for JSON.parse requires (ie MUST accept) that duplicate 
> keys are accepted and that the value associated with the last 
> duplicated key wins.  A valid implementation of JSON.parse MUST not 
> reject such JSON strings.

IETF has SHOULD as well as MUST, though. Normative specs can say what 
must happen, but also what should happen in a clean-slate or ideal-world 
setting. The Internet evolved with Postel's Law falling out of the process.

Previously you wrote:

 > I would be willing to [lose] the first sentence (containing the 
SHOULD) entirely as it doesn't add any real normative value.

But normative RFCs/internet-drafts that use SHOULD not MUST still have 
value.

 From http://tools.ietf.org/html/rfc2119


    1 <http://tools.ietf.org/html/rfc2119#section-1>. MUST

    This word, or the terms "REQUIRED" or "SHALL", mean that the
    definition is an absolute requirement of the specification.



    2 <http://tools.ietf.org/html/rfc2119#section-2>. MUST NOT

    This phrase, or the phrase "SHALL NOT", mean that the
    definition is an absolute prohibition of the specification.



    3 <http://tools.ietf.org/html/rfc2119#section-3>. SHOULD

    This word, or the adjective "RECOMMENDED", mean that there
    may exist valid reasons in particular circumstances to ignore a
    particular item, but the full implications must be understood and
    carefully weighed before choosing a different course.



    4 <http://tools.ietf.org/html/rfc2119#section-4>. SHOULD NOT

    This phrase, or the phrase "NOT RECOMMENDED" mean that
    there may exist valid reasons in particular circumstances when the
    particular behavior is acceptable or even useful, but the full
    implications should be understood and the case carefully weighed
    before implementing any behavior described with this label.



    5 <http://tools.ietf.org/html/rfc2119#section-5>. MAY

    This word, or the adjective "OPTIONAL", mean that an item is
    truly optional.  One vendor may choose to include the item because a
    particular marketplace requires it or because the vendor feels that
    it enhances the product while another vendor may omit the same item.
    An implementation which does not include a particular option MUST be
    prepared to interoperate with another implementation which does
    include the option, though perhaps with reduced functionality. In the
    same vein an implementation which does include a particular option
    MUST be prepared to interoperate with another implementation which
    does not include the option (except, of course, for the feature the
    option provides.)



    6 <http://tools.ietf.org/html/rfc2119#section-6>. Guidance in the
    use of these Imperatives

    Imperatives of the type defined in this memo must be used with care
    and sparingly.  In particular, they MUST only be used where it is
    actually required for interoperation or to limit behavior which has
    potential for causing harm (e.g., limiting retransmissions)  For
    example, they must not be used to try to impose a particular method
    on implementors where the method is not required for
    interoperability.


/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130607/e8b660b4/attachment-0001.html>


More information about the es-discuss mailing list