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]))
|
[top-interaction #%top-interaction]))
|
||||||
|
|
||||||
(define-syntax-rule (module-begin form ...)
|
(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)
|
(define-syntax-rule (top-interaction . form)
|
||||||
(strip-context-and-eval (quote-syntax form)))
|
(strip-context-and-eval (quote-syntax form)))
|
||||||
|
@ -24,14 +24,22 @@
|
||||||
|
|
||||||
(define (strip-context-and-eval e)
|
(define (strip-context-and-eval e)
|
||||||
(let ([ns (current-namespace)])
|
(let ([ns (current-namespace)])
|
||||||
(current-namespace namespace)
|
(dynamic-wind
|
||||||
(begin0
|
(lambda ()
|
||||||
|
(current-namespace namespace))
|
||||||
|
(lambda ()
|
||||||
(call-with-continuation-prompt
|
(call-with-continuation-prompt
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(eval-syntax (namespace-syntax-introduce
|
(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))
|
(set! namespace (current-namespace))
|
||||||
(current-namespace ns))))
|
(current-namespace ns)))))
|
||||||
|
|
||||||
(define (strip-context e)
|
(define (strip-context e)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
|
|
||||||
The @scheme[scheme/load] language supports traditional Scheme
|
The @scheme[scheme/load] language supports traditional Scheme
|
||||||
evaluation, where each top-level form in the module body is separately
|
evaluation, where each top-level form in the module body is separately
|
||||||
passed to @scheme[eval]. The namespace for evaluation shares the
|
passed to @scheme[eval] in the same way as for @scheme[load]. The
|
||||||
@tech{module registry} with the enclosing module, but has a separate
|
namespace for evaluation shares the @tech{module registry} with the
|
||||||
top-level environment, and it is initialized with the bindings of
|
enclosing module, but it has a separate top-level environment, and it is
|
||||||
@schememodname[scheme]. The @scheme[scheme/load] library itself
|
initialized with the bindings of @schememodname[scheme]. The
|
||||||
exports only @schemeidfont{#%module-begin} and
|
@scheme[scheme/load] library itself exports only
|
||||||
@schemeidfont{#%top-interaction} forms that swap in the evaluation
|
@schemeidfont{#%module-begin} and @schemeidfont{#%top-interaction}
|
||||||
namespace and call @scheme[eval].
|
forms that effectively swap in the evaluation namespace and call
|
||||||
|
@scheme[eval].
|
||||||
|
|
||||||
For example, the body of a module using @scheme[scheme/load] can
|
For example, the body of a module using @scheme[scheme/load] can
|
||||||
include @scheme[module] forms, so that running the following module
|
include @scheme[module] forms, so that running the following module
|
||||||
|
|
Loading…
Reference in New Issue
Block a user