[racket-dev] define-for-syntax optional/keyword arguments
`define-for-syntax' doesn't allow optional or keyword arguments,
although the documentation suggests it should.
I tried to fix this myself, but I'm getting a mysterious compile error.
spaghetti:plt clklein$ git diff
diff --git a/collects/racket/private/kw.rkt b/collects/racket/private/kw.rkt
index 136ff9e..a926bd6 100644
--- a/collects/racket/private/kw.rkt
+++ b/collects/racket/private/kw.rkt
@@ -13,6 +13,7 @@
(#%provide new-lambda new-λ
new-define
+ new-define-for-syntax
new-app
make-keyword-procedure
keyword-apply
@@ -698,7 +699,16 @@
(normalize-definition stx #'new-lambda #t #t)])
(quasisyntax/loc stx
(define #,id #,rhs))))
+
+ ;; ----------------------------------------
+ ;; `define-for-syntax' with keyword arguments
+ (define-syntax (new-define-for-syntax stx)
+ (let-values ([(id rhs)
+ (normalize-definition stx #'new-lambda #t #t)])
+ (quasisyntax/loc stx
+ (define-for-syntax #,id #,rhs))))
+
;; ----------------------------------------
;; `#%app' with keyword arguments
diff --git a/collects/racket/private/pre-base.rkt b/collects/racket/private/pre-
index a9326cd..e03e83d 100644
--- a/collects/racket/private/pre-base.rkt
+++ b/collects/racket/private/pre-base.rkt
@@ -5,7 +5,7 @@
(#%require (for-syntax '#%kernel))
(#%require "more-scheme.rkt"
"misc.rkt"
- (all-except "define.rkt" define)
+ (all-except "define.rkt" define define-for-syntax)
"letstx-scheme.rkt"
"kw.rkt"
"define-struct.rkt"
@@ -84,6 +84,7 @@
(rename new-lambda lambda)
(rename new-λ λ)
(rename new-define define)
+ (rename new-define-for-syntax define-for-syntax)
(rename new-app #%app)
(rename new-apply apply)
new-apply-proc ; for access by Typed Racket
spaghetti:plt clklein$ raco setup
raco setup: bootstrapping from source...
collects/racket/private/kw.rkt:708:46: compile: unbound identifier in
module (in phase 1, transformer environment) in: new-lambda
=== context ===
/Users/clklein/git/plt/collects/setup/main.rkt:111:24
loop
/Users/clklein/git/plt/collects/setup/main.rkt: [running body]
/Users/clklein/git/plt/collects/raco/main.rkt: [running body]
I don't get the error when I `racket' the files I changed.
spaghetti:plt clklein$ racket collects/racket/private/pre-base.rkt
spaghetti:plt clklein$
Is there some bootstrapping trick I need to know?