At 08:23 PM 8/16/00 +0000, Perl6 RFC Librarian wrote:
>=head3 Scoping problems
>
>Let's  presume the  example often  cited, of  wishing to  close  a file
>handle during the unwind, here's some C++ for that:
>
>   FILE *handle;
>   try {
>      handle = fopen ( ... );
>      ...
>   }
>   catch ( ... ) {
>     fclose ( handle );
>     throw;
>   }
>
>Note that  "handle" has  to be  defined outside the  scope of  the try,
>because catch  cannot see the  scope defined by  the try block,  and is
>completely  unable to  recover from  problems that  are  not explicitly
>hoisted outside of the try block.

This is a good point, and an argument for the try, catch, and finally 
blocks sharing the same lexical scope the way that continue blocks do with 
while.  Another reason to call it 'continue' instead of 'finally' :-)

--
Peter Scott
Pacific Systems Design Technologies

Reply via email to