Re: posix-error and a list of scheme procedure arguments
Marc Nieper-WiÃkirchen 15 Aug 2020 11:16 UTC
Am Sa., 15. Aug. 2020 um 12:58 Uhr schrieb <xxxxxx@ancell-ent.com>:
> The theory I've been working on is that it's the responsibility of the calling Scheme procedure to catch such thrown errors and turn them into proper SRFI 170 errors. Like too many other details, I've fudged this for the SRFI 170 Chibi Scheme sample implementation, its automagic FFI only throws type check errors, I just mechanically duplicate that checking in the calling Scheme procedure. An error like EPERM, which of course can only be detected at the C level, is done through an error return value and then (improper) querying of errno.
>
> Having 'scheme-procedure be #f deprives the user of valuable information that could make debugging quite a bit harder, although if you fake the values for the 'args key it probably won't be too bad.
>
> One alternative that occurs to me is that you could pass to the C code the calling Scheme procedure, or as you note, examine the stack to get that and the args.
Depending on the implementation there may be no stack entry. And you
probably don't want the overhead to pass the called Scheme procedure
and its arguments in the generic case where there is no error.
The information about the called procedure and its arguments is
certainly useful for debugging, but it is probably best to leave it up
to the implementation how (and if) this information is provided (at
least until we have some general consensus about debugging
facilities).
Marc