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/
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/