lua-users home
lua-l archive

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

On Thu, Jul 19, 2018 at 12:08 AM, Roberto Ierusalimschy <> wrote:
That would be much harder to implement. Also, this functionality seems a
little "off topic". I thought the idea was related to resource
finalization/clean up. I don't see why resource finalization would
be able to supress an exception, which often has nothing to do with
the resource.

It's tied to Lua not having try-catch syntax (as opposed to pcall), allowing:

      local scoped function catch(e)
          -- conditional catch...
      -- try block...

which is superior to pcall() since the try block doesn't need to be wrapped in a function.  As we know, that idiom breaks return, goto, etc. which are important to keeping the main code path simple.

Agreed it's lower priority than the other benefits on the table.  As long as the exit function can discern error or not, and exit call order is the reverse of declaration, I think we've got a very good value.