-
Notifications
You must be signed in to change notification settings - Fork 63
Remove Tuple & Variant #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Tuple & Variant #158
Conversation
d8e48ba
to
1738c04
Compare
A bit of research has shown that atdgen generates both |
1738c04
to
0bb7265
Compare
Thanks to @hhugo for pointing them out
This seems to be unused in Yojson and Atd
Is this going to kill |
@c-cube I don't think it will break ppx_deriving_yojson too bad, as it encodes tuples as lists and variants as lists with the name of the constructor as first argument, if I remember correctly. Here's the code: https://github.com/ocaml-ppx/ppx_deriving_yojson/blob/61f2d63138ec1efea0a3fb4afa682f40497ec380/src/ppx_deriving_yojson.ml#L115-L148 The biggest (only?) issue will probably be Atd which uses Tuple and Variant, but I believe it would make sense in that case to adopt the same encoding strategy that ppx_deriving_yojson uses. Which has the advantage that the JSON it generates is standard-compliant and thus more interoperable with non-OCaml tools. |
I don't think it's a big issue, and it's a good move forward. Atdgen will make its To see the dependencies on Yojson functions, I used this:
Occurrences such as See ahrefs/atd#412 |
Its not tested anymore and unused by Yojson
@mjambon That's a great list, will be very handy! I've been looking at the I'm thinking that as we're breaking compatibility anyway to become more JSON-compliant, might be sensible to bite the bullet and make the |
ce6e250
into
ocaml-community:master
CHANGES: *2025-05-39* ### Changed - Floats are now always output to JSON in a standard-conformant way or not at all (raising an exception). This makes the `std` variants of functions identical to the non-`std` variants and the `std` arguments have no effect. Users are encouraged to switch to the non-`std` affixed variants, the others will be deprecated in the future. (ocaml-community/yojson#184, @Leonidas-from-XIV) - Bumped the minimum required version of OCaml for the main package to 4.08 since the CI dropped the support. This however allows removing the dependency on the `seq` library, so the depencency cone becomes slightly smaller. (ocaml-community/yojson#194, @Leonidas-from-XIV) ### Fixed - Fixed handling of escape sequences in JSON5. Known escapes like \b will be properly unescaped and undefined escape sequences will unescape to the character itself as per spec (ocaml-community/yojson#187, @david-maison-TrustInSoft) - Fixed tests failing on Windows due to disagreements with the length of an input channel and the text mode conversion (ocaml-community/yojson#192, @Leonidas-from-XIV) ### Removed - Removed support for Tuple and Variant in JSON. It was a non-standard extension that was rarely used, so this simplifies the Yojson types and the parser more standard-conforming (ocaml-community/yojson#105, ocaml-community/yojson#158, ocaml-community/yojson#185 @Leonidas-from-XIV)
CHANGES: *2025-05-39* ### Changed - Floats are now always output to JSON in a standard-conformant way or not at all (raising an exception). This makes the `std` variants of functions identical to the non-`std` variants and the `std` arguments have no effect. Users are encouraged to switch to the non-`std` affixed variants, the others will be deprecated in the future. (ocaml-community/yojson#184, @Leonidas-from-XIV) - Bumped the minimum required version of OCaml for the main package to 4.08 since the CI dropped the support. This however allows removing the dependency on the `seq` library, so the depencency cone becomes slightly smaller. (ocaml-community/yojson#194, @Leonidas-from-XIV) ### Fixed - Fixed handling of escape sequences in JSON5. Known escapes like \b will be properly unescaped and undefined escape sequences will unescape to the character itself as per spec (ocaml-community/yojson#187, @david-maison-TrustInSoft) - Fixed tests failing on Windows due to disagreements with the length of an input channel and the text mode conversion (ocaml-community/yojson#192, @Leonidas-from-XIV) ### Removed - Removed support for Tuple and Variant in JSON. It was a non-standard extension that was rarely used, so this simplifies the Yojson types and the parser more standard-conforming (ocaml-community/yojson#105, ocaml-community/yojson#158, ocaml-community/yojson#185 @Leonidas-from-XIV)
CHANGES: *2025-05-39* ### Changed - Floats are now always output to JSON in a standard-conformant way or not at all (raising an exception). This makes the `std` variants of functions identical to the non-`std` variants and the `std` arguments have no effect. Users are encouraged to switch to the non-`std` affixed variants, the others will be deprecated in the future. (ocaml-community/yojson#184, @Leonidas-from-XIV) - Bumped the minimum required version of OCaml for the main package to 4.08 since the CI dropped the support. This however allows removing the dependency on the `seq` library, so the depencency cone becomes slightly smaller. (ocaml-community/yojson#194, @Leonidas-from-XIV) ### Fixed - Fixed handling of escape sequences in JSON5. Known escapes like \b will be properly unescaped and undefined escape sequences will unescape to the character itself as per spec (ocaml-community/yojson#187, @david-maison-TrustInSoft) - Fixed tests failing on Windows due to disagreements with the length of an input channel and the text mode conversion (ocaml-community/yojson#192, @Leonidas-from-XIV) ### Removed - Removed support for Tuple and Variant in JSON. It was a non-standard extension that was rarely used, so this simplifies the Yojson types and the parser more standard-conforming (ocaml-community/yojson#105, ocaml-community/yojson#158, ocaml-community/yojson#185 @Leonidas-from-XIV)
It has been long time on my mind but now that Yojson 2.x is finally out, we can start looking at the next step, Yojson 3.0 (which I assume should be a fairly minor issue issue, given most consumers probably don't ever deal with
`Tuple
or`Variant
).The code itself is pretty self-explanatory, it mostly eliminates the
TUPLE
andVARIANT
CPPO variables and then deletes some support code.There might be more code to be deleted, like
start_any_variant
/start_any_tuple
. I assume these might be used by atd (need to look into it) so I just removed the part that parses non-standard syntax but maybe it can be removed altogether, along with the unit test that covers it.Closes #104