[CM] What is the "normal" way to handle errors for side effect functions in Scheme?
iainduncanlists at gmail.com
Sun May 17 12:31:43 PDT 2020
Here's a snippet of what I'm trying, corrections or confirmation welcome:
// error and abort if not an int vector and table name
if( !s7_is_vector(s7_source_vector) ||
// error posts to the max console
char *error_msg = "vector->table: arg 1 must be an integer vector";
return s7_error(s7, s7_make_symbol(s7, "io-error"),
s7_make_string(s7, error_msg) );
// do other stuff, let's say it's all good
On Sun, May 17, 2020 at 12:11 PM Iain Duncan <iainduncanlists at gmail.com>
> Hi folks, I'm hoping an experienced schemer can help me. I have a
> collection of FFI functions that are called for their side effects (ie
> writing to a table or buffer in Max). They can error out if, for example,
> they are called with a non-existent table name. I know what they should do
> in Max (post to the error log), but am not sure what the right thing is for
> them to do in a Scheme API. Right now I have my pure side-effect functions
> return Scheme nil when they are done. In Python, I would throw an
> exception. If anyone can point me at how to implement this so that
> experienced schemer's doing thing the API is garbage, that would be lovely.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist