News for hackers. Stuff that matters.
Re:A New Go API for JSON by layer8 on Wednesday November 04, 2026 @06:24PM (#50372863)
The spec (RFC 8259) leaves various leeways to implementations:

A JSON parser MAY accept non-JSON forms or extensions.

An implementation may set limits on the size of texts that it accepts. An implementation may set limits on the maximum depth of nesting. An implementation may set limits on the range and precision of numbers. An implementation may set limits on the length and character contents of strings.

At then there’s more vagaries with JSON schema.

Re:A New Go API for JSON by kccqzy on Wednesday November 04, 2026 @07:42PM (#50373491)
Yeah that’s what I mean by strictly. Does your implementation take shortcuts or does it hold itself to a higher standard and not do that?
Re:A New Go API for JSON by anthk on Wednesday November 04, 2026 @10:35PM (#50374814)
Which C standard? ANSI C? C99?
Re:A New Go API for JSON by kccqzy on Thursday November 05, 2026 @10:21AM (#50380225)
C99 and all subsequent versions.
Re:A New Go API for JSON by queenkjuul on Wednesday November 04, 2026 @10:43PM (#50374880)
I don't get your argument here. You say Haskell conforms strictly to the spec and that's a good thing, okay. But then if the C spec allows for truncated names, a compiler could strictly follow the spec and truncate names. So strictly following the spec is not in fact the whole story
Re:A New Go API for JSON by kccqzy on Wednesday November 04, 2026 @10:57PM (#50374987)
Yeah very sorry for the confusion. I should not have used the word strictly. I explained my definition of strictly in the above comment and it’s not really strictly in the dictionary sense. I apologize for my bad writing.
Re:A New Go API for JSON by layer8 on Thursday November 05, 2026 @07:19AM (#50378233)
The thing is this goes both ways. For example, JSON with duplicate keys is valid JSON, and the standard specifies two ways to handle them. To support all ways JSON is used, an implementation will have to provide for both ways, and decide which one to pick as the default. The stricter default on the parsing side is at the same time the less interoperable one. Same for numeric precision: seamlessly allowing higher precision on the generating side lowers interoperability, while accepting it on the parsing side increases interoperability (but also places higher demands on the consuming application). So what do you do? There is no easy and simple answer.