Skip to content
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

support core boolean values #55

Closed
wants to merge 2 commits into from
Closed

Conversation

haarg
Copy link
Contributor

@haarg haarg commented Aug 25, 2021

There is currently a draft PR to add trackable boolean values to perl: Perl/perl5#19040

This PR adds support for those boolean values to JSON::PP.

The first commit recognizes the core boolean values and encodes them as JSON true/false values. If the core change goes ahead, this would definitely be wanted.

The second commit decodes JSON booleans into core perl boolean values. This would be nice, and is what we would want if perl had always had core boolean values. But it presents compatibility problems. Possibly we'll want a different solution, like a ->core_bools method as an easy alternative to ->boolean_values(!!0, !!1).

@haarg
Copy link
Contributor Author

haarg commented Aug 25, 2021

While it's not guaranteed that the core change will be merged, I figured it would be good to start discussion here about how to handle it.

@Grinnz
Copy link

Grinnz commented Aug 25, 2021

I agree that the decode to core bools should be opt-in to start with.

lib/JSON/PP.pm Show resolved Hide resolved
Perl now has support for tracking boolean values. Use this to encode
perl booleans as json booleans.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants