[CM] Bug regarding hooks

Christos Vagias chris.actondev at gmail.com
Sat Jan 1 09:11:25 PST 2022


Thanks for the fix Bil! (I see that Snd 22.0 contains the call_setter fix)

Also, pipe-chars without catch seems cleaner, thanks!

And happy new year!

On Fri, 31 Dec 2021 at 21:22, <bil at ccrma.stanford.edu> wrote:
>
> Here's a change that might be interesting.  Change call_setter (ca line
> 46598) to:
>
> static s7_pointer call_setter(s7_scheme *sc, s7_pointer slot, s7_pointer
> new_value)
> {
>    s7_pointer func = slot_setter(slot);
>    if (!is_any_procedure(func))
>      return(new_value);
>
>    if (is_c_function(func))
>      return(call_c_function_setter(sc, func, slot_symbol(slot),
> new_value));
>
>    sc->args = (has_let_arg(func)) ?
>                 list_3(sc, slot_symbol(slot), new_value, sc->curlet) :
>                list_2(sc, slot_symbol(slot), new_value);
>    return(s7_call(sc, func, sc->args));
> }
>
> I think the problem is that the error (in the setter function) longjmps
> which (in the old call_setter) exited the recursive eval call, but
> did not fixup the eval_done on the scheme stack.  A simple example:
>
> (define (fc in)
>    (catch 'wrong-type-arg
>      (lambda ()
>        (+ in 2))
>      (lambda (type info)
>        type)))
>
> (define state
>    (let ()
>      (define file #f)
>      (define contents #f)
>      (set! (setter 'file)
>           (lambda (s v)
>             (set! contents (fc #\1))
>             v))
>      (curlet)))
>
> (set! (state 'file) 321)
>
> (format *stderr* "done: ~S ~S~%" (state 'file) (state 'contents))
>


More information about the Cmdist mailing list