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

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

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
August 4, 2021 15:31
Subject:
Re: Pre-RFC: Real "boolean" SV type
Message ID:
20210804163107.104d8057@shy.leonerd.org.uk
On Wed, 04 Aug 2021 16:24:45 +0100
ilmari@ilmari.org (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

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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