[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000119.002] 'next' undefines variables in 'continue' block



On Sun, 23 Jan 2000 14:17:25 +0100, "Matthias Urlichs" wrote:
>Tim Bunce:
>> > There is one remaining problem with local-ized values still being visible
>> > in the continue block after a next, but that will have to wait for another
>> > day.
>> 
>> That sounds like a borderline feature. Some people may be using it.
>> 
>Either a block is a block, no matter how you get there, or the continue
>part is embedded in the block it is continuing -- conceptually, that is.
>
>At the moment, we have some sort of pseudo block around a while(){} anyway,
>i.e. the variables declared inside the parentheses are visible within the
>block but not outside -- even though they're not declared within the braces
> -- so an argument may be made for either case.

Looks like there's some misunderstanding here--the case I was referring
to doesn't have any variables localized in the conditional, only in the
body.  This:

    while (!$x++) {
        local $x = 7;
	next;
    }
    continue {
        print $x;
    }

will print "7" instead of "1".  After the patches I showed, removing the
C<next;> makes it print "1", but the above still prints "7".


Sarathy
gsar@ActiveState.com


References to:
"Matthias Urlichs" <smurf@noris.net>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]