diff --git a/compiler/bootstrapped-primitives.rkt b/compiler/bootstrapped-primitives.rkt index 9826ddd..d548e8d 100644 --- a/compiler/bootstrapped-primitives.rkt +++ b/compiler/bootstrapped-primitives.rkt @@ -3,14 +3,18 @@ "expression-structs.rkt" "lexical-structs.rkt" "il-structs.rkt" - "compiler.rkt" + (except-in "compiler.rkt" compile) "compiler-structs.rkt") +(require (rename-in "compiler.rkt" + [compile whalesong-compile])) + + (require/typed "../parameters.rkt" (current-defined-name (Parameterof (U Symbol LamPositionalName)))) (require/typed "../parser/parse-bytecode.rkt" - (parse-bytecode (Path -> Expression))) + (parse-bytecode (Any -> Expression))) (require/typed "../parser/baby-parser.rkt" [parse (Any -> Expression)]) @@ -80,10 +84,14 @@ ,(make-GotoStatement (make-Reg 'proc))))))) (: make-bootstrapped-primitive-code (Symbol Any -> (Listof Statement))) -(define (make-bootstrapped-primitive-code name src) - (parameterize ([current-defined-name name]) - (append - (compile (parse src) (make-PrimitivesReference name) next-linkage/drop-multiple)))) +(define make-bootstrapped-primitive-code + (let ([ns (make-base-namespace)]) + (lambda (name src) + (parameterize ([current-defined-name name]) + (append + (whalesong-compile (parameterize ([current-namespace ns]) + (parse-bytecode (compile src))) + (make-PrimitivesReference name) next-linkage/drop-multiple)))))) diff --git a/scribblings/cs19.scrbl b/scribblings/cs19.scrbl index a219f5e..a8fb935 100644 --- a/scribblings/cs19.scrbl +++ b/scribblings/cs19.scrbl @@ -495,8 +495,8 @@ For example, For a web-world program, output is normally done by using @racket[to-draw]. However, side effecting functions, such as -@racket[printf] or @racket[display], are still available, and are -allowed to continue to append to @tt{document.body}. +@racket[printf] or @racket[display], are still available, and will +append to @tt{document.body}. We may want to disable such printing or redirect it to a particular element on the page. For such purposes, use a combination of @@ -511,8 +511,9 @@ For example: ... (big-bang ... (on-tick (lambda (world dom) - (printf "Tick!\n") - (add1 world))) + (begin + (printf "Tick!\n") + (add1 world)))) ...) }|