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))

_______________________________________________
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to