From: Matt Wette <matt.wette@gmail.com>
To: Guile User Mailing List <guile-user@gnu.org>
Subject: please explain prompt scope
Date: Tue, 17 Oct 2017 05:38:42 -0700 [thread overview]
Message-ID: <8B7B0A98-9FFD-4A57-B881-066693AE9626@gmail.com> (raw)
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
next reply other threads:[~2017-10-17 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 12:38 Matt Wette [this message]
2017-10-20 1:42 ` please explain prompt scope Matt Wette
2017-10-25 0:22 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8B7B0A98-9FFD-4A57-B881-066693AE9626@gmail.com \
--to=matt.wette@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).