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

Re: bug or not? constants warn only once

Thread Previous | Thread Next
From:
Abigail
Date:
April 25, 2008 04:43
Subject:
Re: bug or not? constants warn only once
Message ID:
20080425114307.GA28497@abigail.be
On Fri, Apr 25, 2008 at 09:06:39AM +0200, H.Merijn Brand wrote:
> On Thu, 24 Apr 2008 18:39:35 +0100, Nicholas Clark <nick@ccl4.org>
> wrote:
> 
> > On Thu, Apr 24, 2008 at 07:23:50PM +0200, H.Merijn Brand wrote:
> > 
> > > > The implementation caches the numeric result, and uses that next time round,
> > > > before it gets a chance to warn. It's been this way since (at least) 5.005_03
> > > > (which is the oldest perl I have hanging around)
> > > > 
> > > > So is this a bug? Advice from Klortho #11943 suggests not:
> > > 
> > > Not a bug. I recall relying on this behaviour somewhere to speed up
> > > loops. When you add 0 to a string value, it fills the IV/NV, so inside
> > > the loop it doesn't have to convert.
> > 
> > Oh, I didn't mean that the caching was a bug. No, caching is key.
> > I meant that not warning felt buggy.
> 
> Then I wasn't verbose enough too, as I think it should warn once and
> only once. Maybe until either value changes.


I agree. Repeating warnings is bad, IMO. It is a warning after all;
if converting a non-numerical string to a number is deemed to be so
dangerous a repeat warning is in order, a fatal error would be better.



Abigail

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