[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: David Given <dg@...>
- Date: Sat, 09 Jan 2010 17:52:47 +0000
-----BEGIN PGP SIGNED MESSAGE-----
On 09/01/10 09:55, steve donovan wrote:
> For instance, many of us crave a straightforward try..except
> construct, although we're fully aware that it is sugar for pcall().
> (A straightforward implementation of try..except is possible, except
> that it's hard to detect whether a function issued an explicit return
> or not)
As an aside, I actually did this for Objective Lua --- you can return
from inside the try or catch and it all works correctly.
However, this raised some design issues about what to do with the
exception once you've caught it. As Lua tends to throw strings for
run-time errors, you need an annoying amount of boilerplate to first
check to see if the exception is an object, then to check to see if the
exception supports an interface you understand, then to check to see if
the exception is the one you actually wanted --- every time.
So just supporting try...catch isn't quite enough to make exceptions
work. We also need the infrastructure to make exceptions meaningful,
which requires additional thought.
Of course, now I'm going to have to rewrite Objective Lua to work with
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│ "Under communism, man exploits man. Under capitalism, it's just the
│ opposite." --- John Kenneth Galbrith
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----