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

Re: Missing sv_numeq() function?

Thread Previous
From:
Paul "LeoNerd" Evans
Date:
August 20, 2021 16:38
Subject:
Re: Missing sv_numeq() function?
Message ID:
20210820173801.696f681e@shy.leonerd.org.uk
On Fri, 20 Aug 2021 13:09:00 +0000
Nicholas Clark <nick@ccl4.org> wrote:

> On Fri, Aug 20, 2021 at 11:55:00AM +0100, Paul "LeoNerd" Evans wrote:
> > The behaviour in perl's `eq` operator is exposed to XS authors via
> > 
> >    BOOL sv_eq(SV *left, SV *right);
> > 
> > Nice and simple.  
> 
> That's not quite accurate. Overloaded comparison is handled one level
> out:
> 
> PP(pp_seq)
> {
>     dSP;
>     tryAMAGICbin_MG(seq_amg, 0);
>     {
>       dPOPTOPssrl;
>       SETs(boolSV(sv_eq_flags(left, right, 0)));
>       RETURN;
>     }
> }

Ah, yes I was aware of that but I didn't explain that in the email.

> That's probably sane, but:
> 1) What sv_eq_flags() is a better API
> 2) And if it isn't, it would be better if we exposed consistent API

Yes good ideas there - an sv_numeq_flags() would be better.

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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About