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

Re: Pre-RFC: Real "boolean" SV type Nicholas Clark <>

Thread Previous | Thread Next
Salvador Fandiño
August 5, 2021 11:35
Re: Pre-RFC: Real "boolean" SV type Nicholas Clark <>
Message ID:
On 5/8/21 12:58, Paul "LeoNerd" Evans wrote:

> I don't yet have a good thought about "no", but since PL_sv_yes carries
> its own stringification PV, it's possible that sv_setsv could notice
> it's that special value and store it as-is, with SvLEN == 0, into the
> target. So it's now possible to distinguish any true bool value, by
>    SvIV(sv) == 1 && SvPVX(sv) == SvPVX(&PL_sv_yes)

That would impede one for having boolean dualvars.

Programmers may want to have booleans that stringify as True/False, T/F, 
Yes/No, 1/0, or the current 1/"".

Actually, I would say the current PL_sv_no stringification ("") is not 
the one the programmer needs in most cases.

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