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

[perl #134230] Numifying a 0x string evaluates the hex number

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
August 20, 2019 05:53
Subject:
[perl #134230] Numifying a 0x string evaluates the hex number
Message ID:
rt-4.0.24-27030-1566280384-1637.134230-15-0@perl.org
On Fri, 28 Jun 2019 03:36:08 -0700, sisyphus@cpan.org wrote:
> On Thu, 27 Jun 2019 22:34:32 -0700, ikegami@adaelis.com wrote:
> > Changing this means changing Scalar::Util::looks_like_number. Would
> > that
> > break things?
> 
> I agree that looks_like_number()also needs to be thought about.
> 
> Perl's current behaviour is to issue the "isn't numeric" warning when
> "0xff"+0 is evaluated.
> However, I doubt that such a warning is valid now that "0xff" is
> numified to 255.
> It was certainly a valid warning when "0xff" numified to 0 ... but I'm
> thinking that warning should not be emitted for the current behaviour,
> and nor should looks_like_number("0xff") return FALSE.

I don't think looks_like_number() needs to change - I think C<"0xff"> needs to return to numerically evaluating as 0, pre the attached.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134230

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