Giter Site home page Giter Site logo

Comments (9)

rurban avatar rurban commented on July 17, 2024

Thanks for the good test cases.
Many people do have different opinions about this. But JSON::PP should be matched

from cpanel-json-xs.

rurban avatar rurban commented on July 17, 2024

so encode should detect builtin::true, and decode optionally on core_bools

from cpanel-json-xs.

karenetheridge avatar karenetheridge commented on July 17, 2024

so encode should detect builtin::true, and decode optionally on core_bools

That sounds reasonable to me. I expect that most of the time decoding to a core bool would make sense, but there might be a reason why it should be disabled (e.g. to cope with older code that looks explicitly for JSON::PP::Booleans?) so leaving a way to turn it off would be good.

from cpanel-json-xs.

rohanc avatar rohanc commented on July 17, 2024

I agree with @karenetheridge that it would be useful to control the decoding behaviour. Both JSON::PP and JSON::XS allow this via the boolean_values method.

If this gets adopted and the default is off, I'll be looking for a way to turn it on globally, especially when I'm using tools like Mojolicious, where Cpanel::JSON::XS is used internally.

from cpanel-json-xs.

karenetheridge avatar karenetheridge commented on July 17, 2024

I have prepared support in JSON::MaybeXS to support recognizing core booleans in its is_bool() interface, but I will wait until Cpanel::JSON::XS supports them before releasing -- otherwise, there might be surprising behaviour due to the mismatch of the results of is_bool() and serializing those booleans.

from cpanel-json-xs.

rurban avatar rurban commented on July 17, 2024

Yes, the boolean_values method will also be in, to provide the same API as JSON::PP. I'm just a bit too busy right now

from cpanel-json-xs.

rurban avatar rurban commented on July 17, 2024

I"ve delayed this feature for the 4.37 fixes for the 5.38 release, because I couldn't get it right yet. XS specialist help appreciated. I took the JSON::PP t/core_bools.t as reference.

from cpanel-json-xs.

leonerd avatar leonerd commented on July 17, 2024

XS specialist help appreciated

Any specific questions or advice required?

from cpanel-json-xs.

leonerd avatar leonerd commented on July 17, 2024

Any further thoughts here? I'm in the middle of writing some slides to present to FOSDEM, about how Perl has had proper boolean support since 5.36 and "all the serialisation modules will cope", except that I'm finding that most of them still don't. It'd be great to have this sorted and fixed.

I draw specific attention to my question above; namely:

XS specialist help appreciated

Any specific questions or advice required?

from cpanel-json-xs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.