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

Should Devel::PPPort provide SvIsBOOL() ?

Thread Next
Paul "LeoNerd" Evans
September 12, 2021 10:46
Should Devel::PPPort provide SvIsBOOL() ?
Message ID:
I've been looking at adding some of my recent core function additions
into Devel::PPPort [1] and hit upon a bit of a question.

I can add the new sv_setbool() because really, it's just

  sv_setsv(sv, boolSV(bool))

which is easy to backport. I can't easily do the same for the
SvIsBOOL() test function because older perls don't have a concept of
"this variable is boolean in nature". It *could* be argued that makes
it really simple:

  #define SvIsBOOL(sv)   FALSE

which would technically work, and technically provide an answer to any
XS modules running on such perls. But is it right?

In a way I feel it best to just not provide the function at all. On
those older perls, it's less that no SV has boolean-nature, and more
that this isn't a valid question to be asking about an SV, and so lets
not provide a wrapper function for it at all.

If no wrapper function exists then XS code can easily just

  #ifdef SvIsBOOL

much as I'm already doing.

Thoughts, anyone?

[1]: This in itself has not been an easy task - I may write an
additional email about that later.

Paul "LeoNerd" Evans      |  |

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