[plt-scheme] why does the ellipsis not work?
The following is extracted and simplified as much as possible from a bigger piece of code.
Sorry that I could not condence it any further.
; file lazy.ss ----------------------------------------
(module lazy mzscheme
(provide lazy)
(define module-name (gensym 'module-name-lazy-))
(define-syntax lazy
(syntax-rules ()
((lazy expr) (lazy/proc 'expr))))
(define (lazy/proc expr)
(let/cc cc
(eval
`(module ,module-name
"lazy-language.ss"
,cc ,expr))))
; inorder to make require superfluous
(lazy/proc 'initialize)
(eval `(require ',module-name)))
; module name quoted for 3.99.0.9
; file lazy-language.ss ---------------------------------
(module lazy-language mzscheme
(provide macro scheme
(rename mod-begin #%module-begin)
(rename #%datum #%top)) ; allow free vars
(define-syntax (macro stx)
(syntax-case stx ()
((_ (id keywords rule ...) ... expr)
#'(letrec-syntaxes
(((id ...) (#%app values (syntax-rules keywords rule ...) ...)))
expr))))
(define-syntax scheme
(syntax-rules ()
((_ x) (#%app eval 'x))
((_ x y ...) (#%app (#%app eval 'x) y ...))))
(define-syntax mod-begin
(syntax-rules ()
((_ cont x)
(#%module-begin
(#%app (#%datum . cont) x))))))
; using the above -------------------------
; definitions window
(require "lazy.ss" )
(lazy
(macro (a () ((a x y) (scheme list x y)))
(a p q))) ; --> (p q) ok
(lazy
(macro (a () ((a x ...) (scheme list x ...)))
(a p q))) ; --> (p q) ok
(lazy
(macro (a () ((a x ...) (scheme list x ...)))
(a p q r))) ; --> error: a: bad syntax in: (a p q r)
Run: interactions-window:
Welcome to DrScheme, version 3.99.0.9-svn6jan2008 [3m].
Language: Textual (MzScheme, includes R5RS)
(p q)
(p q)
lazy.ss:12:3: a: bad syntax in: (a p q r)
>
This used to work in all earlier versions of MzScheme. Now many things have changed, I know. What change do I overlook? It seems like in the calls to syntax lazy, the ellipses are taken for a common identifier. Any help will be very much appreciated. I already tried to parse the rules given to syntax macro, replacing every occurrence of identifier '...' by a locally introduced ellipsis, but that did not help.
Jos Koot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080107/b12dbf4c/attachment.html>