problem w/ STk and slib macro-by-example 
Author Message
 problem w/ STk and slib macro-by-example

I am having a problem with STk (3.1.1) and SLIB (2a5) macros-by-example:

I have a macro (via define-syntax/syntax-rules) which converts

        (define-button <3> l p)
into
        (list "<3>" l p)

The list is evenually caddr'd and the p passed to bind.  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?

Thanks,
Matt
--



Sat, 17 Apr 1999 03:00:00 GMT  
 problem w/ STk and slib macro-by-example

+---------------
| ...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

-----

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



Sun, 18 Apr 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. stk and slib still not cooperating

2. STk can't find Slib

3. using slib's macros

4. SLIB Texinfo file examples

5. precedence parsing and slib: example?

6. STk server.stk goofiness?

7. Load-time problem with a macro that defines a macro

8. STk dynamic loading problem

9. problems compiling STk-2.1 on Linux box

10. Problem using SLIB with Bigloo

11. Install problem: make SLIB to work with Chez

12. Problem using SLIB with Gambit-C

 

 
Powered by phpBB® Forum Software