lua-users home
lua-l archive

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


Nodir Temirhodzhaev wrote:

> This finally block must be executed once whenever returned from function
> or error throwed.
> funcbody ::= '(' [parlist1] ')' block1 [finally block2] end

The use case (cleaning up after errors) is like exceptions in Ada, but
what you propose is more general, but without passing arguments to the
handler. I think it would be even more general, and would provide the
ability to clean up inner scoped locals, if 'finally' were applied to
code blocks. So:

  block ::= chunk | finally { stat[;] }

It can't replace chunk since chunk includes a return or break statement.

I believe this would preclude tail calls in functions with finalization.

Doug

-- 
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220