[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (final) now available
- From: Sean Conner <sean@...>
- Date: Thu, 15 Jan 2015 21:37:24 -0500
It was thus said that the Great Andrew Starks once stated:
> On Thursday, January 15, 2015, Tim Hill <drtimhill@gmail.com> wrote:
>
> I think it might be useful to reserve the word "error" for "things that
> disrupt the stack" and something like "fail" for a return value that
> indicates the function's failure to return a result.
I go into some detail about this in my blog:
http://boston.conman.org/2009/12/01.2
I classify errors into four types (one of which could be considered "a
bug") and I mention there are only three ways to handling them.
> Thinking about something in a different way has implications. If we stop
> conflating exceptional return values ;) by calling them "errors", it may
> help clarify their roll.
Lisp people talk about "conditions", not "errors".
> open_file"foo"
> -->false, "NO 'foo'"
> read_next_chunk()
> -->nil, "TIMEOUT"
>
> Both of these make sense to me and would make less sense to me if they were
> reversed. Also, neither are errors in programming or in the system. As far
> as the context of the program is concerned, neither are errors, at all.
But both can be handled the same way:
fp,err = open_file "foo"
if not fp then
blowup(err)
end
data,err = read_next_chunk()
if not data then
blowup(err)
end
but only because nil and false are falsey values.
-spc
- References:
- Re: [ANN] Lua 5.3.0 (final) now available, Dirk Laurie
- Re: [ANN] Lua 5.3.0 (final) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (final) now available, Jorge
- Re: [ANN] Lua 5.3.0 (final) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (final) now available, Jorge
- Re: [ANN] Lua 5.3.0 (final) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (final) now available, Jorge
- Re: [ANN] Lua 5.3.0 (final) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (final) now available, Tim Hill
- Re: [ANN] Lua 5.3.0 (final) now available, Andrew Starks