[plt-scheme] a Chez vs. PLT syntax-rules incompatibility

From: Benderjg2 at aol.com (Benderjg2 at aol.com)
Date: Thu May 13 14:22:51 EDT 2004

Earlier this week I was playing with "Mini-KANREN" from Dan Friedman, 
Oleg, et al. In making their code work under PLT, one of the few
things I had to change was one of their syntax-rules macros:

(define-syntax construct-relation
  (syntax-rules ()
    [(_ any (arity-id* ...) ([g rel] ...))
     (let ([g rel] ...)
       (lambda (arity-id* ...)
         (any (g arity-id* ...) ...)))]
    [(_ any (arity-id* ...) (let-pair ...) rel rel* ...)
     (construct-relation any (arity-id* ...) (let-pair ... [g rel]) rel* ...)]))

The above version gives the following error under PLT:
> syntax: too many ellipses in template in: ...

I had to change the macro to something like:

(define-syntax construct-relation
  (syntax-rules ()
    [(_ any arity-id-list ([g rel] ...))
     (let ([g rel] ...)
       (lambda arity-id-list
         (any (g . arity-id-list) ...)))]
    [(_ any (arity-id* ...) (let-pair ...) rel rel* ...)
     (construct-relation any (arity-id* ...) (let-pair ... [g rel]) rel* ...)]))

I verified that the first version does work under Petite Chez Scheme.
But is the a bug in PLT's syntax rules? Or something that really shouldn't
work, even in Chez, but just does? (e.g. something that is a bad idea.)

Jim




Posted on the users mailing list.