unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* please explain prompt scope
@ 2017-10-17 12:38 Matt Wette
  2017-10-20  1:42 ` Matt Wette
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Wette @ 2017-10-17 12:38 UTC (permalink / raw)
  To: Guile User Mailing List

Here is a program that uses prompt and capture the continuation in top-level binding.

(define (sf fmt . args) (apply simple-format #t fmt args))

(define At (make-prompt-tag))

(define Ak #f)

(let ((a 2))
  (call-with-prompt At
    (lambda ()
      (sf "hello\n")
      (abort-to-prompt At)
      (sf "world where a=~S\n" a))
    (lambda (k . args)
      (set! Ak k)
      (sf "!\n")))
  (set! a 99))

(Ak)

Here is the output:
hello
!
world where a=99

Can someone explain how `a' is captured in the continuation?
Does the continuation include the stack outside `prompt'?

Thanks much.
Matt




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-25  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 12:38 please explain prompt scope Matt Wette
2017-10-20  1:42 ` Matt Wette
2017-10-25  0:22   ` Matt Wette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).