throw vs the result

Phil Davis davis.phil at comcast.net
Sun May 1 00:27:06 EDT 2005


Dar Scott wrote:
> On Apr 30, 2005, at 3:22 PM, Dar Scott wrote:
> 
>> I was wondering what people prefer as far as "fatal" errors in 
>> executing a custom command, such as in a library.
>>
>> Should that be in a non-empty value returned by result()?
>> Or should that cause some error message to the thrown?
>> Or does it depend on the error?
> 
> 
> OK, well, what about a library that exports lots of functions, such as a 
> math library?  Functions don't have a separate result for an error.
> 
> Should the error be a special value in the result and propagated through?
> Or should an error function tell whether there was an error since the 
> last call to error function?
> Or should an error be thrown?


I like the 'special value' idea.

What if the last (or first?) param passed to the function by my script 
is the value to be returned to my script if an error occurs?

OR, maybe the error value is in a known global I can set.

However it's implemented, I personally like having a user-definable 
error value.

Phil Davis




More information about the use-livecode mailing list