On Sun, 20 Aug 2000, Tony Olekshy wrote:

> 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.

If all those pieces were in the same scope I think it would still work
like this (in Perl5-ish code):

{
  try { fragile(); # It must be Italian }
  my $caught;
  catch { $caught = 1; }
  finally { $caught and ... }
}

It's the same as in perl5 with a block:

{
   print $foo;
   my $foo = 1;
}

This is a compile time error because $foo isn't in scope til its declared.


Of course, what I know about the Perl internals fits on the head of a pin
so someone more knowledgeable should feel free to jump in.

-dave

/*==================
www.urth.org
We await the New Sun
==================*/

Reply via email to