lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 9/23/06, John Belmonte <> wrote:
 The D language has native support for this [3], allowing you to execute
actions on scope failure (i.e. when an exception occurred), success, or
both.  Functional/object implementations work just as well, such as the
ScopeGuard class for C++ [4].

python 1.5 added a "with" statement for cleanup on block exit:

   with open('/etc/passwd', 'r') as f:
       for line in f:
           <do stuff>
   # f is closed here