Subject: Re: problem w/ STk and slib macro-by-example
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1996/10/30
Newsgroups: comp.lang.scheme
Message-ID: <5573kh$er9@tokyo.engr.sgi.com>

Matt Wette <mwette@mr-ed.jpl.nasa.gov> wrote:
+---------------
| ...problem with STk (3.1.1) and SLIB (2a5) macros-by-example: When I use 
| 	(define cancel (lambda (x y) misc-stuff))
| 	(define-button <3> "cancel" cancel)
| Things work OK, but when I use
| 	(define-button <3> "cancel" (lambda (x y) misc-stuff))
| I get an error like 
| 	*** Background error
| 	unbound variable g482
| The stack trace says
| 	(#[closure 1baf74] g482 g483)
| 	<<< STACK BOTTOM >>>
| Anybody have a clue what the problem could be here?
+---------------

The "gNNN" are generated symbols (from "gensym"), probably because a macro
expansion tries to rename all the non-free variables in the macro body, to
avoid capturing any of *your* names. Looks like it got its levels mixed
maybe, and renamed "x" and "y" in the body of the lambda, but not in the
formals list. (Just guessing, actually. I don't know macros that well.)

Also, make sure that you have the right set of literals (aux keywords)
in your "syntax-rules". E.g., if you had an "x" there it would *not* get
renamed. (...which might cause this kind of problem?)


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com
Silicon Graphics, Inc.		http://reality.sgi.com/rpw3/
2011 N. Shoreline Blvd.		Phone: 415-933-1673  FAX: 415-933-0979
Mountain View, CA  94043	PP-ASEL-IA