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

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

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
August 6, 2021 06:04
Subject:
Re: Pre-RFC: Real "boolean" SV type
Message ID:
CAExogxN4WqT9ZTuGqj+6nzbkQBBiivgAHww_4DTLRM3+WgLvfA@mail.gmail.com
2021-8-6 9:25 Darren Duncan <darren@darrenduncan.net> 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
> JSON
> 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
> we LOSE INFORMATION.
>
> 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
world.
.
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About