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

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

Thread Previous | Thread Next
Paul "LeoNerd" Evans
August 4, 2021 15:31
Re: Pre-RFC: Real "boolean" SV type
Message ID:
On Wed, 04 Aug 2021 16:24:45 +0100 (Dagfinn Ilmari Mannsåker) wrote:

> Should these also pass?
>     is( svtype(!0) ,"BOOL", 'PL_sv_yes is SVt_BOOL' );
>     is( svtype(!1) ,"BOOL", 'PL_sv_no is SVt_BOOL' );

Indeed - I forgot to mention but I'd also propose making PL_sv_yes/no
themselves be SVt_BOOL, rather than their current form of SVt_PVIV.

> And if so, only in the scope of `use feature 'bool';`, or everywhere?

I don't see why it can't be everywhere. A perl new enough to have
svtype() would be new enough in which no/yes are true booleans and not
PVIVs-in-disguise. The feature guard is really just to guard the `true`
and `false` keyword syntax, rather than the underlying semantics of the
boolean type.

Paul "LeoNerd" Evans      |  |

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