develooper Front page | perl.perl5.porters | Postings from August 2021

Re: Pre-RFC: Real "boolean" SV type

Thread Previous | Thread Next
Yuki Kimoto
August 6, 2021 06:04
Re: Pre-RFC: Real "boolean" SV type
Message ID:
2021-8-6 9:25 Darren Duncan <> wrote:

> What's needed is a boolean type whose values are disjoint from all numbers
> and
> all strings, the latter 2 also being disjoint from each other.
> One needs to be able to round-trip losslessly, which would only happen if
> these
> were disjoint.
> A JSON false or true converted to Perl and back to JSON needs to still be
> false or true respectively.
> A JSON number 0 or 1 converted to Perl and back to JSON needs to be a JSON
> number 0 and 1.
> A JSON empty string '' or strings '0' or '1' need to convert to Perl and
> back to
> JSON as those same strings.
> And so on.
> If there wasn't a disjoint boolean type and Perl functions false/true just
> generated numbers or strings, then we wouldn't have round-tripping, which
> means
> So not losing information is what is desired.
> -- Darren Duncan

JSON has the types of string, number, and boolean.

Perl don't has types of string, number, and boolean at least from the user
These are all scalar type.

Perl, on the other hand, has types internally represented by flags.

Is this topic talking about the types of the user world, or about the
internal types?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About