On Thu, Nov 12, 2009 at 1:46 PM, John Clements <cleme...@brinckerhoff.org> wrote: > Unlib.plt doesn't compile, as you (Sam) reported several weeks ago. I tried > to fix the problem, and started wondering whether the underlying problem was > whether 'define-match-expander' was working incorrectly. For instance, what > should this program produce? > > foo.ss: > > #lang scheme > > (define-match-expander my-cons > (error 'dontcare "aagh!") > cons) > > (provide (rename-out [my-cons cons])) > > bar.ss: > > #lang scheme > > (require "foo.ss") > > (cons 3 4) > > Reading the docs, it looks like it should produce the pair containing 3 and > 4, but it actually signals the error. It appears to me that the untyped > folks are (mis?)reading the docs in the same way I am. > > Am I wrong, or is define-match-expander broken, or is something else going > on? > > Thanks, > > John
John, Looks right to me. The define-match-expander form takes two expressions, both of which are evaluated immediately at phase 1 (compile-time) to produce transformers. It's basically define-syntax for a different kind of binding. You are writing as if it were define-syntax-rule, where you just fill in a pattern. Replace your use of it with: (define-match-expander my-cons (lambda (stx) (error 'dontcare "aagh!")) (syntax-rules () [(_ a b) (cons a b)])) Then you'll probably get the behavior you expected. --Carl _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-dev