!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

431 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.144 Servers

Load older messages


SenderMessageTime
20 Mar 2026
@piegames:flausch.socialpiegamesImagine one Nix implementation who always takes the first attribute, on that always takes the last attribute, and one that takes whichever based on some internal hashmap09:57:32
@emilazy:matrix.orgemilyso unless there is existing divergence I wouldn't make it worse without reason09:57:34
@emilazy:matrix.orgemilyyes, for sure. one of a million reasons there needs to be a spec09:57:52
@emilazy:matrix.orgemilybut "imagine one Nix implementation that aborts" is just another possibility in that list too09:58:04
@commentator2.0:elia.gardenRutile (rootile)

Ah, so thats how we get language detection:

{"language": "cppnix", "language": "lix"}
09:58:14
@emilazy:matrix.orgemilyit'd be interesting to see how pre-nlohmann 2.3 handled it though09:58:30
@emilazy:matrix.orgemilythere's other divergences in JSON handling from 2.3 already09:58:36
@piegames:flausch.socialpiegames yes, but on a different domain. Given that aborts cannot be caught, you cannot produce two different Nix inputs that terminate with a different output value 09:59:02
@emilazy:matrix.orgemily(but in practice 2.3 behaviour is just deprecated given that Nixpkgs doesn't support it any more and everyone has diverged from it)09:59:04
@emilazy:matrix.orgemilyright, I agree that abort vs. not is the least bad kind of divergence09:59:26
@emilazy:matrix.orgemilyit's going to be really annoying if you have an RFC-valid JSON document that you simply can't interoperate with from Nix just because it's weird/cursed though, if there is otherwise no divergence10:00:09
@emilazy:matrix.orgemily(and it's not possible to abort on every Nix behaviour that's weird enough that an implementation without a reference spec might get it wrong, because … it's load-bearing weird behaviours all the way down)10:00:35
@piegames:flausch.socialpiegamesTo be honest the root issue is with the RFC itself10:01:04
@piegames:flausch.socialpiegames even other libraries typically have an option "RFC compliant vs safe&sane", because for many applications, this is a security issue 10:01:44
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them)
In reply to @kfears:matrix.org
https://seriot.ch/software/parsing_json.html
We would like to point again to this gem of a blogpost that dissects extremely well how many RFCs and versions JSON has and how much is left to be interpretation-dependent, so you could very easily be RFC-compliant and also diverge from other parsers in major and very painful and noticeable ways
10:03:23
@piegames:flausch.socialpiegamesAre there any other specifications of JSON other than that RFC?10:04:02
@emilazy:matrix.orgemilythere are multiple RFCs10:04:47
@emilazy:matrix.orgemilyand the original spec on json.org or whatever which is 100% useless10:04:55
@emilazy:matrix.orgemilyI-JSON defines a restricted format for interoperability10:05:01
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them)It could make sense to refer to the behaviors and quirks of the currently used JSON parser directly and state outright "this is what we're working with", and roll back behaviors back to that baseline if changing the parser impl10:05:04
@emilazy:matrix.orgemilybut a JSON parser definitely shouldn't insist on only parsing I-JSON, it's for reference for JSON producers and use in other RFCs10:05:19
@emilazy:matrix.orgemilyanyway10:05:29
@emilazy:matrix.orgemily we're not talking about dodgy Nix programs here, we're talking about dodgy things in another spec and program input 10:05:43
@emilazy:matrix.orgemilybeing unnecessarily conservative there is far more painful/gratuitous than when it's about actual Nix code10:06:00
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them)
In reply to @piegames:flausch.social
Are there any other specifications of JSON other than that RFC?

Quoting the linked blog post:

Yet JSON is defined in at least seven different documents: 2002 - json.org, and the business card 2006 - IETF RFC 4627, which set the application/json MIME media type 2011 - ECMAScript 262, section 15.12 2013 - ECMA 404 according to Tim Bray (RFC 7159 editor), ECMA rushed out to release it because: "Someone told the ECMA working group that the IETF had gone crazy and was going to rewrite JSON with no regard for compatibility and break the whole Internet and something had to be done urgently about this terrible situation. (...) It doesn’t address any of the gripes that were motivating the IETF revision. 2014 - IETF RFC 7158 makes the specification "Standard Tracks" instead of "Informational", allows scalars (anything other than arrays and objects) such as 123 and true at the root level as ECMA does, warns about bad practices such as duplicated keys and broken Unicode strings, without explicitly forbidding them, though. 2014 - IETF RFC 7159 was released to fix a typo in RFC 7158, which was dated from "March 2013" instead of "March 2014". 2017 - IETF RFC 8259 was released in December 2017. It basically adds two things: 1) outside of closed eco-systems, JSON MUST be encoded in UTF-8 and 2) JSON text that is not networked transmitted MAY now add the byte order mark U+FEFF, although this is not stated explicitly. Despite the clarifications they bring, RFC 7159 and 8259 contain several approximations and leaves many details loosely specified.

10:06:08
@emilazy:matrix.orgemily(fwiw, new versions of things RFCs specify are always new RFCs, so the fact that there's a bunch of RFCs doesn't mean that there's tons of divergence necessarily, it just means the spec was refined to clarify things and add warnings. the main JSON RFC is meant to be descriptive not prescriptive; that's what I-JSON is for)10:07:19
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them) *

Quoting the linked blog post:

Yet JSON is defined in at least seven different documents:

  • 2002 - json.org, and the business card
  • 2006 - IETF RFC 4627, which set the application/json MIME media type
  • 2011 - ECMAScript 262, section 15.12
  • 2013 - ECMA 404 according to Tim Bray (RFC 7159 editor), ECMA rushed out to release it because:

"Someone told the ECMA working group that the IETF had gone crazy and was going to rewrite JSON with no regard for compatibility and break the whole Internet and something had to be done urgently about this terrible situation. (...) It doesn’t address any of the gripes that were motivating the IETF revision.

  • 2014 - IETF RFC 7158 makes the specification "Standard Tracks" instead of "Informational", allows scalars (anything other than arrays and objects) such as 123 and true at the root level as ECMA does, warns about bad practices such as duplicated keys and broken Unicode strings, without explicitly forbidding them, though.
  • 2014 - IETF RFC 7159 was released to fix a typo in RFC 7158, which was dated from "March 2013" instead of "March 2014". 2017 - IETF RFC 8259 was released in December 2017. It basically adds two things: 1) outside of closed eco-systems, JSON MUST be encoded in UTF-8 and 2) JSON text that is not networked transmitted MAY now add the byte order mark U+FEFF, although this is not stated explicitly.

Despite the clarifications they bring, RFC 7159 and 8259 contain several approximations and leaves many details loosely specified.

10:07:20
@emilazy:matrix.orgemilythat blog post is probably not a good reference in 2026, since it makes no reference to I-JSON etc.10:08:02
@piegames:flausch.socialpiegamesspeaking of chaning the parser impl, I want to get away from nlohmann as soon as we are rewriting the primops in Rust10:10:17
@kfears:matrix.orgKFears& 🏳️‍⚧️ (they/them)Decent starting point, though (and the test suite can be re-ran with modern data)10:10:18

Show newer messages


Back to Room ListRoom Version: 10