bug#62469: ‘throw’ introduces a continuation barrier

Ludovic Courtès <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
‘throw’ introduces a continuation barrier as of Guile 3.0.9:

--8<---------------cut here---------------start------------->8---
$ cat ~/src/guile-debugging/suspendable-continuation.scm
(use-modules (ice-9 control))

(let ((tag (make-prompt-tag)))
  (call-with-prompt tag
    (lambda ()
      (catch #t
        (lambda ()
          (pk 'suspendable-from-catch? tag (suspendable-continuation? tag))
          (throw 'whatever))
        (const #t)
        (lambda args
          (pk 'suspendable-from-exn-handler? tag (suspendable-continuation? tag)))))
    (const #t)))
$ guile ~/src/guile-debugging/suspendable-continuation.scm

;;; (suspendable-from-catch? ("prompt") #t)

;;; (suspendable-from-exn-handler? ("prompt") #f)
--8<---------------cut here---------------end--------------->8---

Apparently this is because that goes through ‘scm_throw’ via
‘intrinsics.c’.

A practical consequence is that a REPL running in Fibers on non-blocking
ports enters an endless “Attempt to suspend fiber within continuation
barrier” loop when it starts a recursive REPL due to an uncaught
exception.

Ludo’.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.