From 9617dbbfd68ff488445f615c5e0afca30cc6c80a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 14 Apr 2008 16:39:43 +0000 Subject: [PATCH] fix continuation prompt in scheme/load svn: r9297 --- collects/scheme/load.ss | 26 ++++++++++++------- .../scribblings/reference/load-lang.scrbl | 15 ++++++----- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/collects/scheme/load.ss b/collects/scheme/load.ss index f327e419ef..8794f28170 100644 --- a/collects/scheme/load.ss +++ b/collects/scheme/load.ss @@ -4,7 +4,7 @@ [top-interaction #%top-interaction])) (define-syntax-rule (module-begin form ...) - (#%plain-module-begin (top-interaction . form) ...)) + (#%plain-module-begin (top-interaction . (#%top-interaction . form)) ...)) (define-syntax-rule (top-interaction . form) (strip-context-and-eval (quote-syntax form))) @@ -24,14 +24,22 @@ (define (strip-context-and-eval e) (let ([ns (current-namespace)]) - (current-namespace namespace) - (begin0 - (call-with-continuation-prompt - (lambda () - (eval-syntax (namespace-syntax-introduce - (strip-context e))))) - (set! namespace (current-namespace)) - (current-namespace ns)))) + (dynamic-wind + (lambda () + (current-namespace namespace)) + (lambda () + (call-with-continuation-prompt + (lambda () + (eval-syntax (namespace-syntax-introduce + (strip-context e)))) + (default-continuation-prompt-tag) + (lambda args + (apply abort-current-continuation + (default-continuation-prompt-tag) + args)))) + (lambda () + (set! namespace (current-namespace)) + (current-namespace ns))))) (define (strip-context e) (cond diff --git a/collects/scribblings/reference/load-lang.scrbl b/collects/scribblings/reference/load-lang.scrbl index ee706f1cb6..10a0187596 100644 --- a/collects/scribblings/reference/load-lang.scrbl +++ b/collects/scribblings/reference/load-lang.scrbl @@ -7,13 +7,14 @@ The @scheme[scheme/load] language supports traditional Scheme evaluation, where each top-level form in the module body is separately -passed to @scheme[eval]. The namespace for evaluation shares the -@tech{module registry} with the enclosing module, but has a separate -top-level environment, and it is initialized with the bindings of -@schememodname[scheme]. The @scheme[scheme/load] library itself -exports only @schemeidfont{#%module-begin} and -@schemeidfont{#%top-interaction} forms that swap in the evaluation -namespace and call @scheme[eval]. +passed to @scheme[eval] in the same way as for @scheme[load]. The +namespace for evaluation shares the @tech{module registry} with the +enclosing module, but it has a separate top-level environment, and it is +initialized with the bindings of @schememodname[scheme]. The +@scheme[scheme/load] library itself exports only +@schemeidfont{#%module-begin} and @schemeidfont{#%top-interaction} +forms that effectively swap in the evaluation namespace and call +@scheme[eval]. For example, the body of a module using @scheme[scheme/load] can include @scheme[module] forms, so that running the following module