develooper Front page | perl.perl5.porters | Postings from April 2017

Re: [perl #130801] SvNV() does not store computed value to NV slot

Thread Previous | Thread Next
April 12, 2017 08:37
Re: [perl #130801] SvNV() does not store computed value to NV slot
Message ID:
On 20 February 2017 at 23:36, Karl Williamson via RT
<> wrote:
> I don't have an answer to this question, but I can tell you why a stringified NV isn't stored.  It is because the radix character varies by locale.  In Czech, I believe it is a comma; in English, a period.  And if the locale changes the character changes, and a PV that was generated in a different locale will be invalid.  There were various bug tickets filed because of this. so we stopped storing the stringified number.  Another approach would be to attach magic to it, like we do now to PVs that have been collated.  The magic knows what locale was used for the stringification, and if the locale changes (reasonably unlikely) invalidate the PV.

Is there a reason we cannot make this "no-cache" behavior "use locale" specific?

For instance I would have thought the logic would be: if under "use
locale" we do not trust the PV slot of a PVNV, and we do not cache any
stringifications of NV's, and when not under "use locale" we trust the
PV slot, and we do cache any stringifications.


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About