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

Re: bug or not? constants warn only once

Thread Previous
From:
Nicholas Clark
Date:
April 26, 2008 08:53
Subject:
Re: bug or not? constants warn only once
Message ID:
20080426155313.GB84051@plum.flirble.org
On Fri, Apr 25, 2008 at 01:07:29PM -0500, David Nicol wrote:
> On Fri, Apr 25, 2008 at 5:17 AM, Nicholas Clark <nick@ccl4.org> wrote:
> 
> >  didn't do what I expected, because that constant string "constant" in the
> >  optree isn't constant. Well, it can't be written to, but it gets conversions
> >  cached on it.
> 
> If conversions of constants were done early instead
> of cached, there wouldn't even be the opportunity to warn.
> 
> Do we have consensus on this issue?

No, because then all constants would use a lot more memory:

$ perl -MDevel::Peek -e 'sub a {Dump $_[0]; $_[0] + 0} a("pie") for 0,1'
SV = PV(0x801168) at 0x80021c
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x2017c0 "pie"\0
  CUR = 3
  LEN = 4
SV = PVNV(0x803468) at 0x80021c
  REFCNT = 1
  FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK)
  IV = 0
  NV = 0
  PV = 0x2017c0 "pie"\0
  CUR = 3
  LEN = 4

Nicholas Clark

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