shifted eval code, probably not needed

This commit is contained in:
Matthias Felleisen 2012-07-01 18:40:52 -04:00
parent 4cd26f828f
commit 89d6ebaab6
2 changed files with 19 additions and 15 deletions

View File

@ -34,7 +34,6 @@ tests to run:
(require racket/provide)
(provide
define-module-local-eval
provide-and-scribble all-from all-from-except
)
@ -201,16 +200,3 @@ tests to run:
[name:id #'name]))
lon))
;; ---------------------------------------------------------------------------------------------------
;; (define-module-local-eval name-of-evaluator)
;; a make-base-eval whose namespace is initialized with the module where the macro is used
(define-syntax-rule
(define-module-local-eval name)
(begin
(define-namespace-anchor ns)
(define name
(parameterize ([sandbox-namespace-specs (list (lambda () (namespace-anchor->namespace ns)))]
[sandbox-error-output 'string]
[sandbox-output 'string])
(make-base-eval)))))

View File

@ -3,6 +3,10 @@
(require teachpack/2htdp/scribblings/img-eval racket/sandbox mzlib/pconvert file/convertible scribble/eval)
(provide
;; syntax:
;; use with (define-module-local-eval e) ... (eval 'foo e)
define-module-local-eval
;; syntax:
;; use with @interaction[#:eval (*sl-eval (define x ...) ...) ...] to create interactive examples
bsl-eval
@ -92,4 +96,18 @@
(asl-eval def ...)
(*sl-eval 'lang/htdp-advanced 'htdp/asl/lang/reader def ...))
; (isl-eval+)
; (isl-eval+)
;; -----------------------------------------------------------------------------
;; (define-module-local-eval name-of-evaluator)
;; a make-base-eval whose namespace is initialized with the module where the macro is used
(define-syntax-rule
(define-module-local-eval name)
(begin
(define-namespace-anchor ns)
(define name
(parameterize ([sandbox-namespace-specs (list (lambda () (namespace-anchor->namespace ns)))]
[sandbox-error-output 'string]
[sandbox-output 'string])
(make-base-eval)))))