fix continuation prompt in scheme/load
svn: r9297
This commit is contained in:
parent
9851d4aa0f
commit
9617dbbfd6
|
@ -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
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(current-namespace namespace))
|
||||
(lambda ()
|
||||
(call-with-continuation-prompt
|
||||
(lambda ()
|
||||
(eval-syntax (namespace-syntax-introduce
|
||||
(strip-context e)))))
|
||||
(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))))
|
||||
(current-namespace ns)))))
|
||||
|
||||
(define (strip-context e)
|
||||
(cond
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user