[CM] Handling an accidental forever loop

Iain Duncan iainduncanlists at gmail.com
Wed Jan 27 08:12:19 PST 2021


Thanks Bill. That matches what i was guessing, that tail call optimization
was going to mean stack limitations wouldn't work anyway. I don't think we
can get the signal in Max either. I did a test yesterday and found out that
the same situation exists in the javascript object in Max, so I have a
feeling if the host platform had a way to do this, Cycling 74 would be
doing it already with the js object. Perhaps using begin_hook is an option
if I can make it optional, I definitely don't want to slow down all
execution. I appreciate the response!

iain

On Wed, Jan 27, 2021 at 6:31 AM <bil at ccrma.stanford.edu> wrote:

> You can set (*s7* 'max-stack-size) which will raise an
> error if the stack gets beyond that size.  Tail recursion
> does not affect the stack, so the stack-max-size only
> catches "normal" infinite recursion.  I don't know the
> context, but in nrepl I trap SIGINT (control-C) and
> raise an error in the interrupt handler -- look for
> set_sigint_handler and related code in nrepl.c.  This
> is then enabled during s7_eval_string in nrepl.scm.
> I just noticed (of course!) that it only works once --
> not sure why you can't interrupt successive expressions.
> Snd (and maybe Grace) use s7's begin_hook to interrupt
> computation, but that slows down everything (it is
> polling the begin_hook and calling a function each time)
> and might not work in loops that the optimizer has
> so tightly optimized that no scheme-level body exists.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20210127/8ed252ff/attachment.html>


More information about the Cmdist mailing list