Dave Rolsky wrote:
> 
> Tony Olekshy wrote:
> 
> >       try { fragile(); }
> >       catch { my $caught = 1; }
> >       finally { $caught and ... }
>
> 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.

But in the shared scope, $catch isn't referenced until after the my
in lexical order.  I'm just worrying about the details of what happens
during the dynamics of execution.  I think it's more like saying:

    {
    if ($foo) { my $bar = 1; }
    $bar and ...
    }

where the outer block represents this "shared lexical scope" concept.
For this to work, doesn't storage for $bar have to be allocated and
initialized to undef at the beginning of the outer block?

Yours, &c, Tony Olekshy

Reply via email to