[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (final) now available
- From: Tim Hill <drtimhill@...>
- Date: Wed, 14 Jan 2015 13:11:16 -0800
> On Jan 14, 2015, at 12:49 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:
>
> Then we could stop returning errors as nil,message and just throw exceptions.
> Another way to encourage this is to have a standard error format that can be
> reliably caught or re-thrown. The simplest would be to write error messages as
> "error name: details". Anything else like errors made of two strings, tables,
> or a new Exception type I think are unnecessarily complicated.
>
> --
> tom <telliamed@whoopdedo.org>
>
Actually I’d go further and say what’s missing here is a first-class error type. This would naturally solve the nil+message issues since errors could always be distinguished from non-errors with no in-band/out-band ambiguity (which is really the issues here). It would also simplify functions that only return one value, since there is no need to add an auxiliary variable to capture the error message from the second return value. This also naturally fits with exception-based handling as well, though I wont go into how this can be done here.
—Tim