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

Should Devel::PPPort provide SvIsBOOL() ?

Thread Next
From:
Paul "LeoNerd" Evans
Date:
September 12, 2021 10:46
Subject:
Should Devel::PPPort provide SvIsBOOL() ?
Message ID:
20210912114628.0bb7a736@shy.leonerd.org.uk
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
    ...
  #endif

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

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

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