[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: error() or nil, 'error msg'
- From: Jorge <xxopxe@...>
- Date: Sat, 20 Sep 2014 20:04:34 -0300
On 09/19/2014 06:52 PM, Andrew Starks wrote:
First, I appreciate anyone and everyone that is sticking with me on
this. I hope that I do not sound argumentative. The responses thus far
are helpful.
Just in case, I must say I find these kind of threads wildly interesting :)
Your example is essentially how I do everything now. Here is the pcall
variant, for comparison:
I think the conceptual difference is that the ret,err scheme assumes you
care more for the result, and only then for details on errors, and in
the pcall is the other way: you first want to know if there was an
error, then take care of the return.
Another con of pcall based APIs is that it looks like boilerplate code:
if I am supposed to always do some magic incantation for invoking the
library under the risk of crashing everything, then why the library
doesn't do it itself for me :)
Jorge
- References:
- error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Rena
- Re: error() or nil, 'error msg', Dirk Laurie
- Re: error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Jorge
- Re: error() or nil, 'error msg', Hisham
- Re: error() or nil, 'error msg', Andrew Starks
- Re: error() or nil, 'error msg', Jorge
- Re: error() or nil, 'error msg', Andrew Starks