lua-users home
lua-l archive

Re: 3rd UPDATE: try-catch-finally for Lua, 02/1/2008

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


on 1/31/08 7:43 PM, Hu Qiwei at huqiwei@gmail.com wrote:
> 3) Scoping change: local variables defined in try-block will live till
> the end of finally- or catch- block. by popular demand.
Isn't that tricky to make work with variables that may not even be declared
at the point where one exits the try block?
 try
 if true then
 return
 end
 local x = { }
 finally
 x[ 1 ] = "foo"
 end
"x" isn't even defined at the point where we exit the try block. (I had an
even more twisted version where I used the ability to redeclare local
variables and started the try block with "local x = 3".
Mark

AltStyle によって変換されたページ (->オリジナル) /