>>>>> "TO" == Tony Olekshy <[EMAIL PROTECTED]> writes:
>> Syntactically the have to be next to one another, so write
>> them as one.
TO> If you write this:
TO> try { my $p = P->new;
TO> my $q = Q->new;
TO> }
TO> finally { $p->Done;
TO> $q->Done;
TO> }
TO> what happens if both constructors succeed, but $p->Done dies?
Blech.
try { my $p = P->new; }
try { my $q = Q->new; }
finally { $p->Done; }
If P barfs then there is no q. If q barfs, then there is only a p.
And if you argue that there is more complicated stuff going on in
the try block. Then you'll never get anything worked out.
Doing a whole series of finally's will not help you without thinking
about the problem of restoring the invariants.
And this is a perfect example where my 'no exceptions' would be handy.
Just do all the cleanups and ignore any throws.
(Yes, it still doesn't help you with the invariant but is much neater.
And if it really is needed, then perhaps a finally block would simply
automaticall a 'no exception' to have all throws translated into
returns.)
<chaim>
--
Chaim Frenkel Nonlinear Knowledge, Inc.
[EMAIL PROTECTED] +1-718-236-0183