On Thu, Jun 21, 2007 at 06:47:11PM +0200, Rafael Garcia-Suarez wrote:
> On 21/06/07, Steve Hay <[EMAIL PROTECTED]> wrote:
> >With the attached patch I now have all tests successful.
> >
> >I remember lots of discussion a while ago about constructions like "my
> >$x = 1 if $y;". I don't remember what the conclusion of it all was,
> >except that it's probably best avoided. Is that right?
> 
> Yes, that's right, because that could bypass initialisation of $x if
> $y is false, leaving the previous value in it, like in state vars.
> 
> Note that in 5.10, you'll have a warning for a special case of this 
> construct :
> 
> $ bleadperl -we 'my $x if 0'
> Deprecated use of my() in false conditional at -e line 1.

I thought that issue only related to a "compile-time constant false"
(such as the one in your example) and not to a runtime expression that
happend to be false sometimes.

Looking at it another way, are you saying that (ignoring closures)
subroutine scoped lexicals are not cleared when the subroutine exits,
but persist (consuming memory) until the subroutine is reentered?

Tim.

Reply via email to