[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: [perl #130801] SvNV() does not store computed value to NV slot
From:       pali () cpan ! org
Date:       2017-02-28 13:22:26
Message-ID: 20170228132225.GA32181 () pali
[Download RAW message or body]

On Monday 27 February 2017 16:00:00 Tony Cook via RT wrote:
> On Tue, 21 Feb 2017 01:43:35 -0800, pali@cpan.org wrote:
> > Ah, I forgot 'use locale;' when testing.
> > 
> > But back to my question, do you know why behaviour is different for
> > magical and non-magical scalar? This explanation for locale does not
> > make sense otherwise it should not be stored also for non-magical
> > scalar.
> 
> I'm pretty sure storing the NV as we currently do is a bug:

So it means that SvNV() should not store computed value to NV slot, right?

> $ LANG=de_DE.utf8 ./perl -Ilib -Mlocale -le '$x = "0,42"; print $x+0; no locale; print $x+0'
> 0,42
> 0.42
> 
> $ LANG=de_DE.utf8 ./perl -Ilib -le '$x = "5,42"; print $x+0;'
> 5

And then it is different bug...

> From the discussion in #p5p, is this still an issue for you?

So from discussion I understood that SvNV(), SvIV() and SvUV() does not
have to store computed values into NV or IV slots. It would mean that my
report in this ticket is not a bug and just expected behaviour.

I'm ok with it but I would suggest to explicitly document this behaviour
in perlapi so that it would be clear also for other people.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic