Tony Olekshy wrote:
> Non-shared:
>
> my ($p, $q);
> try { $p = P->new; $q = Q->new; ... }
> finally { $p and $p->Done; }
> finally { $q and $q->Done; }
>
> Shared:
>
> try { my $p = P->new; my $q = Q->new; ... }
> finally { $p and $p->Done; }
> finally { $q and $q->Done; }
In RFC 119v2, you would simply say:
my $p = P->new finally $p->Done;
my $q = Q->new finally $q->Done;
...
No problem with scoping, because the cleanup code is in the same scope
as the setup code, and defined not to be executed at cleanup time unless
the setup code has been executed. (Tony, still haven't reread D88v3,
coming later. Tomorrow?)
> 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:
>
> If it is not possible to have try, catch, and finally blocks
> share lexical scope (due, perhaps, to the vagaries of stack
> unwinding), this feature can simply be deleted, and the outer
> scope can be shared.
>
> Yours, &c, Tony Olekshy
--
Glenn
=====
There are two kinds of people, those
who finish what they start, and so
on... -- Robert Byrne
_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html