From b0043b013bc4ca42373f8b83696976cf907f232e Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Sun, 30 Jun 2013 10:04:34 -0400 Subject: [PATCH] Remove most uses of `mzscheme` in the core. Remaining are: - parts of unit200 that Matthew plans to remove. - the `mzscheme` implementation itself. The implementation of `mzscheme` has been moved to the `mzscheme` collection (from the `racket` and `scheme` collections). The `scheme/mzscheme` language, which was undocumented, has been removed. This is slightly backwards-incompatible, because the `xform` handling of precompiled headers now evaluates code in a `racket/base`-like namespace, instead of in a `mzscheme`-like namespace. original commit: d54c1e4e4942c26dcbaaebcc43d5c92d507a8112 --- racket/lib/collects/mzlib/private/sigutil.rkt | 1 - racket/lib/collects/mzscheme/main.rkt | 112 +++++++++++++++++- .../{racket => mzscheme}/private/old-ds.rkt | 4 +- .../{racket => mzscheme}/private/old-if.rkt | 0 .../private/old-procs.rkt | 34 +++++- .../{racket => mzscheme}/private/old-rp.rkt | 3 +- .../private/stxmz-body.rkt | 7 +- 7 files changed, 148 insertions(+), 13 deletions(-) rename racket/lib/collects/{racket => mzscheme}/private/old-ds.rkt (91%) rename racket/lib/collects/{racket => mzscheme}/private/old-if.rkt (100%) rename racket/lib/collects/{racket => mzscheme}/private/old-procs.rkt (70%) rename racket/lib/collects/{racket => mzscheme}/private/old-rp.rkt (94%) rename racket/lib/collects/{racket => mzscheme}/private/stxmz-body.rkt (79%) diff --git a/racket/lib/collects/mzlib/private/sigutil.rkt b/racket/lib/collects/mzlib/private/sigutil.rkt index 7615bab..ccd2dcc 100644 --- a/racket/lib/collects/mzlib/private/sigutil.rkt +++ b/racket/lib/collects/mzlib/private/sigutil.rkt @@ -1,4 +1,3 @@ - (module sigutil mzscheme ;; Used by unitsig.rkt ;; (needs an overhaul, too) diff --git a/racket/lib/collects/mzscheme/main.rkt b/racket/lib/collects/mzscheme/main.rkt index fc8a611..05311db 100644 --- a/racket/lib/collects/mzscheme/main.rkt +++ b/racket/lib/collects/mzscheme/main.rkt @@ -1,3 +1,111 @@ +;;---------------------------------------------------------------------- +;; mzscheme: provide everything -(module main scheme/mzscheme - (provide (all-from scheme/mzscheme))) +(module mzscheme '#%kernel + (#%require racket/private/more-scheme + (all-except racket/private/misc + collection-path + collection-file-path) + racket/private/letstx-scheme + racket/private/stxcase-scheme + racket/private/stx + racket/private/qqstx + racket/private/define + mzscheme/private/stxmz-body + mzscheme/private/old-ds + mzscheme/private/old-rp + mzscheme/private/old-if + mzscheme/private/old-procs + racket/private/map ; shadows #%kernel bindings + racket/private/kernstruct + racket/private/promise + racket/private/cert + (only racket/private/cond old-cond) + ;; shadows #%kernel bindings: + (only racket/private/list + assq assv assoc reverse) + racket/private/member + racket/tcp + racket/udp + '#%builtin) ; so it's attached + + (#%provide require require-for-syntax require-for-template require-for-label + provide provide-for-syntax provide-for-label + (all-from-except racket/private/more-scheme case old-case + log-fatal log-error log-warning log-info log-debug + hash-update hash-update!) + (rename old-case case) + (all-from racket/private/misc) + collection-path + collection-file-path + (all-from-except racket/private/stxcase-scheme _ datum datum-case with-datum) + (all-from-except racket/private/letstx-scheme + -define -define-syntax -define-struct + cond old-cond else =>) + (rename old-cond cond) + define-struct let-struct + identifier? ;; from racket/private/stx + (all-from racket/private/cert) + (all-from-except racket/private/qqstx quasidatum undatum undatum-splicing) + (all-from racket/private/define) + (all-from racket/private/kernstruct) + force delay promise? + (all-from-except '#%kernel #%module-begin #%datum + if make-empty-namespace + syntax->datum datum->syntax + free-identifier=? + free-transformer-identifier=? + free-template-identifier=? + free-label-identifier=? + vector-copy! + thread-send + thread-receive + thread-try-receive + thread-receive-evt + make-hash make-immutable-hash make-weak-hash + make-hasheq make-immutable-hasheq make-weak-hasheq + hash? hash-eq? hash-weak? + hash-ref hash-set! hash-set + hash-remove! hash-remove + hash-copy hash-count + hash-map hash-for-each + hash-iterate-first hash-iterate-next + hash-iterate-value hash-iterate-key + log-message log-level? make-logger logger? current-logger logger-name + make-log-receiver log-receiver? + prop:incomplete-arity) + (rename syntax->datum syntax-object->datum) + (rename datum->syntax datum->syntax-object) + (rename free-identifier=? module-identifier=?) + (rename free-transformer-identifier=? module-transformer-identifier=?) + (rename free-template-identifier=? module-template-identifier=?) + (rename free-label-identifier=? module-label-identifier=?) + (rename free-identifier=?* free-identifier=?) + make-hash-table hash-table? make-immutable-hash-table + (rename hash-ref hash-table-get) + (rename hash-set! hash-table-put!) + (rename hash-remove! hash-table-remove!) + (rename hash-count hash-table-count) + (rename hash-copy hash-table-copy) + (rename hash-map hash-table-map) + (rename hash-for-each hash-table-for-each) + (rename hash-iterate-first hash-table-iterate-first) + (rename hash-iterate-next hash-table-iterate-next) + (rename hash-iterate-value hash-table-iterate-value) + (rename hash-iterate-key hash-table-iterate-key) + namespace-transformer-require + transcript-on transcript-off + (rename cleanse-path expand-path) + (rename if* if) + (rename list list-immutable) + make-namespace + #%top-interaction + map for-each andmap ormap + assq assv assoc reverse memq memv member + (rename old-datum #%datum) + (rename mzscheme-in-stx-module-begin #%module-begin) + (rename #%module-begin #%plain-module-begin) + (rename lambda #%plain-lambda) + (rename #%app #%plain-app) + (all-from racket/tcp) + (all-from racket/udp))) diff --git a/racket/lib/collects/racket/private/old-ds.rkt b/racket/lib/collects/mzscheme/private/old-ds.rkt similarity index 91% rename from racket/lib/collects/racket/private/old-ds.rkt rename to racket/lib/collects/mzscheme/private/old-ds.rkt index e0b35a7..3b7c9ff 100644 --- a/racket/lib/collects/racket/private/old-ds.rkt +++ b/racket/lib/collects/mzscheme/private/old-ds.rkt @@ -1,8 +1,8 @@ (module old-ds '#%kernel - (#%require "define-struct.rkt" + (#%require racket/private/define-struct (for-syntax '#%kernel - "stxcase-scheme.rkt")) + racket/private/stxcase-scheme)) (#%provide define-struct let-struct old-datum) diff --git a/racket/lib/collects/racket/private/old-if.rkt b/racket/lib/collects/mzscheme/private/old-if.rkt similarity index 100% rename from racket/lib/collects/racket/private/old-if.rkt rename to racket/lib/collects/mzscheme/private/old-if.rkt diff --git a/racket/lib/collects/racket/private/old-procs.rkt b/racket/lib/collects/mzscheme/private/old-procs.rkt similarity index 70% rename from racket/lib/collects/racket/private/old-procs.rkt rename to racket/lib/collects/mzscheme/private/old-procs.rkt index 3e5bec8..c9dcb62 100644 --- a/racket/lib/collects/racket/private/old-procs.rkt +++ b/racket/lib/collects/mzscheme/private/old-procs.rkt @@ -1,20 +1,46 @@ (module old-procs '#%kernel - (#%require "small-scheme.rkt" - "more-scheme.rkt" - "define.rkt" - "member.rkt") + (#%require racket/private/small-scheme + racket/private/more-scheme + racket/private/define + racket/private/member + (only racket/private/misc collection-path collection-file-path)) (#%provide make-namespace free-identifier=?* namespace-transformer-require transcript-on transcript-off + (rename new:collection-path collection-path) + (rename new:collection-file-path collection-file-path) make-hash-table make-immutable-hash-table hash-table?) (define reflect-var #f) + + (define new:collection-path + (let ([collection-path (lambda (collection . collections) + (apply collection-path + (lambda (s) + (raise + (exn:fail:filesystem + (string-append "collection-path: " s) + (current-continuation-marks)))) + collection collections))]) + collection-path)) + + (define new:collection-file-path + (let ([collection-file-path (lambda (file-name collection . collections) + (apply collection-file-path + (lambda (s) + (raise + (exn:fail:filesystem + (string-append "collection-file-path: " s) + (current-continuation-marks)))) + file-name collection collections))]) + collection-file-path)) + (define make-namespace (case-lambda diff --git a/racket/lib/collects/racket/private/old-rp.rkt b/racket/lib/collects/mzscheme/private/old-rp.rkt similarity index 94% rename from racket/lib/collects/racket/private/old-rp.rkt rename to racket/lib/collects/mzscheme/private/old-rp.rkt index 14b78db..b922da9 100644 --- a/racket/lib/collects/racket/private/old-rp.rkt +++ b/racket/lib/collects/mzscheme/private/old-rp.rkt @@ -1,6 +1,7 @@ (module old-rp '#%kernel - (#%require (for-syntax '#%kernel "stx.rkt" "small-scheme.rkt" "stxcase-scheme.rkt")) + (#%require (for-syntax '#%kernel racket/private/stx racket/private/small-scheme + racket/private/stxcase-scheme)) (#%provide require require-for-syntax require-for-template require-for-label provide provide-for-syntax provide-for-label) diff --git a/racket/lib/collects/racket/private/stxmz-body.rkt b/racket/lib/collects/mzscheme/private/stxmz-body.rkt similarity index 79% rename from racket/lib/collects/racket/private/stxmz-body.rkt rename to racket/lib/collects/mzscheme/private/stxmz-body.rkt index 39ccc18..c6de635 100644 --- a/racket/lib/collects/racket/private/stxmz-body.rkt +++ b/racket/lib/collects/mzscheme/private/stxmz-body.rkt @@ -2,8 +2,9 @@ ;; mzscheme's `#%module-begin' (module stxmz-body '#%kernel - (#%require "define.rkt" - (for-syntax '#%kernel "stx.rkt")) + ;; These could probably change to just be `(require racket/base)`. + (#%require racket/private/define + (for-syntax '#%kernel racket/private/stx)) ;; So that expansions print the way the Racket programmer expects: (#%require (rename '#%kernel #%plain-module-begin #%module-begin)) @@ -16,7 +17,7 @@ (list* (quote-syntax #%plain-module-begin) (datum->syntax stx - (list (quote-syntax #%require) '(for-syntax scheme/mzscheme))) + (list (quote-syntax #%require) '(for-syntax mzscheme))) (stx-cdr stx)) stx) (raise-syntax-error #f "bad syntax" stx))))