original commit: 4cb555c73d84cfb4a761ea2180960459ed789691
This commit is contained in:
Matthew Flatt 2001-09-19 22:26:28 +00:00
parent 25333ecf08
commit fbf52dc88d

View File

@ -2,7 +2,8 @@
(module etc mzscheme (module etc mzscheme
(require "spidey.ss") (require "spidey.ss")
(require-for-syntax (lib "kerncase.ss" "syntax") (require-for-syntax (lib "kerncase.ss" "syntax")
(lib "stx.ss" "syntax")) (lib "stx.ss" "syntax")
"private/stxset.ss")
(provide true false (provide true false
boolean=? symbol=? boolean=? symbol=?
@ -434,6 +435,10 @@
(syntax (or (current-load-relative-directory) (syntax (or (current-load-relative-directory)
(current-directory)))))])) (current-directory)))))]))
;; This is a macro-generating macro that wants to expand
;; expressions used in the generated macro. So it's weird,
;; and we put much of the work in a helper macro,
;; `finish-syntax-set'.
(define-syntax (define-syntax-set stx) (define-syntax (define-syntax-set stx)
(syntax-case stx () (syntax-case stx ()
[(_ (id ...) defn ...) [(_ (id ...) defn ...)
@ -454,21 +459,11 @@
"duplicate identifier" "duplicate identifier"
stx stx
dup))) dup)))
(let ([internal-ids (map (lambda (id)
(datum->syntax-object
id
(string->symbol (format "~a/proc" (syntax-e id)))
id))
ids)])
;; We'd like to check the `defns', but that requires ;; We'd like to check the `defns', but that requires
;; and expansion in a different phase. So we punt for now. ;; and expansion in a different phase. So we move
;; into that phase using `finish-syntax-set':
;; Produce result ------------------------------ (with-syntax ([orig-stx stx])
(with-syntax ([(int-id ...) internal-ids])
(syntax/loc stx (syntax/loc stx
(define-syntaxes (id ...) (define-syntaxes (id ...)
(let () (finish-syntax-set orig-stx)))))])))
defn ...
(values int-id ...)))))))])))