[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (final) now available
- From: Javier Guerra Giraldez <javier@...>
- Date: Wed, 14 Jan 2015 17:30:10 -0500
On Wed, Jan 14, 2015 at 3:49 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:
> If library writers are eschewing throwing errors to not inconvenience users
> who aren't properly using pcall, then that contributes to the problem. Being
> more assertive (pun intended) will drag people kicking and screaming into
> proper defensive programming techniques.
I think you're elevating your preferences to "proper techniques".
I happen to prefer the nil,msg pattern for most cases, and to
explicitly use asert() when i want to signal errors. pcall() (and, to
a lesser extent try/catch) are too similar to COMEFROM to my taste, so
i prefer to have only one, at most two levels of pcall() surrounding
most of the main loop or core/plugin interfaces, or so on. i find
more readable to have error-handling code right there where the error
is reported (with the nil return)
--
Javier