Re: RFC 88: Possible problem with shared lexical scope.

[email protected] (Tony Olekshy) Sun, 20 Aug 2000 18:29:33 -0600
Newsgroups perl.perl6.language.errors
Organization Avra Software Lab Inc.
Message-ID <[email protected]>
Dave Rolsky wrote:
> 
> On Sun, 20 Aug 2000, Tony Olekshy wrote:
> 
> >     try { my $p = P->new; my $q = Q->new; ... }
> >     finally { $p and $p->Done; }
> >     finally { $q and $q->Done; }
> >
> > If P->new throws, then the second finally is going to test
> > $q, but it's not "in scope" yet (its my hasn't been seen).
> > Or is it?  If it isn't, I'll take shared lexical scoping out
> > and put a note about this in ISSUES instead of the current:
> 
> This is not an issue (at least if my works in Perl 6 as it does in Perl
> 5).  The scoping is determined at compile time so $q will be in scope
> after this chunk is parsed.  At run time it may or may not get something
> assigned to it but your code already checks that.

That would be nice.  But does this mean that in the following
case:

	try { fragile(); }
	catch { my $caught = 1; }
	finally { $caught and ... }

storage for $caught is allocated and initialized to undef at the
beginning of the *try* block, even though you're not allowed to
see it there?  Finally has to see it, as undef, even if the catch
block isn't entered.

Yours, &c, Tony Olekshy