lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 09/18/2014 01:18 AM, Andrew Starks wrote:
I've been thinking more about this topic.

So, the above quote from the illustrious Dirk seems to be "what smart
people do." That is, there is a consensus around this view.

I don't think I understand it and I'm starting to think that "nil,
error_msg" has no place in my code.

The problem with `nil, error` is that "reasonably expect" is both
unknowable and possibly irrelevant:


In my mind, having a library crash the users program emitting an error() is not well behaved. As a library you don't know how important is whatever you are doing for the host program. Perhaps it doesn't particularly care if you're unable do do you task.

So, who has to agressivelly pcall is the library.

Also, as a final user, I find "nil,error" apis much easier to use.

Jorge