[plt-scheme] Macrology

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Jun 14 12:42:45 EDT 2007

I am experiencing Macro Weirdness:

(module test mzscheme
  (require (lib "kerncase.ss" "syntax")
           (lib "list.ss"))

  (define (test)
    (define (loop stx)
          stx #t  ; <---- HERE
        [(begin e ...)
         (andmap loop (syntax->list #'(e ...)))]
        [(define-values (v ...) ve)
         (loop #'ve)]
        [(define-syntaxes (v ...) ve)
         (loop #'ve)]
        [(let-values ([(v ...) ve] ...) be ...)
        [(quote datum)
         (raise-syntax-error 'anormal "Dropped through:" stx)]))

    ; Works with #t
    (loop (expand (syntax (define-struct posn (x y)))))
    ; Works with #f
    (loop (expand (syntax ())))))

The first example runs when trans?-expr is #t, but the second fails.
These both seem strange as `define-values' and `quote' are the symbols
that are in kernel-syntax-case.

Is kernel-syntax-case broken? Am I broken? Should I just be using
syntax-case*? If so, what identifer=? should I use to really match all
expanded code.


Jay McCarthy <jay.mccarthy at gmail.com>

Posted on the users mailing list.