News for hackers. Stuff that matters.
Re:Comments in JSON by hosay123 on Friday August 02, 2013 @10:30AM (#6147084)
This would completely break any event driven (streaming) parser.
Re:Comments in JSON by the_gipsy on Friday August 02, 2013 @10:49AM (#6147207)
Or a parser that simply discards existing keys.
Re:Comments in JSON by IanCal on Friday August 02, 2013 @10:55AM (#6147257)
Which, importantly, would be perfectly fine according to the spec (as I understand it).
Re:Comments in JSON by masklinn on Friday August 02, 2013 @10:56AM (#6147263)
Indeed, the spec states that keys SHOULD be unique (with RFC 2119 meaning) and leaves behavior unspecified in case of duplicate key.
Re:Comments in JSON by IanCal on Friday August 02, 2013 @11:09AM (#6147366)
My favourite example of dealing with undefined behaviour is this:

In practice, many C implementations recognize, for example, #pragma once as a rough equivalent of #include guards — but GCC 1.17, upon finding a #pragma directive, would instead attempt to launch commonly distributed Unix games such as NetHack and Rogue, or start Emacs running a simulation of the Towers of Hanoi.[7]

Source: http://en.wikipedia.org/wiki/Undefined_behavior

Re:Comments in JSON by jgeerts on Friday August 02, 2013 @10:58AM (#6147286)
It's overwriting existing keys, which is fine imo. When I use a map in any language and put a new value with a new key, expected behavior is that the previous key is overwritten.