The woes of Scheme macros - HELP! 
Author Message
 The woes of Scheme macros - HELP!

I was really fond of hygienic macro systems and the neat pattern
matching present in R4RS macros, until I tried writing some
non-trivial stuff in it.  The one thing which I'd like to do and which
none of the pattern-matching macro systems out there (i.e. R4RS,
syntax-case ...) seem to let me do is this:

On expanding a macro, I want to force the arguments of a macro call
within that macro to be expanded before expanding the outermost macro.

I'm trying to write a nicer version of Dybvig's define-structure-type.
It's ugly in Dybvig's system (all those syntax keywords), it's even
uglier with Clinger's explicit renaming, but it would look beautiful
with syntax-rules if I could factor out the macros that implicitly
generate new names into non-hygienic macros, and do something like this:

  (syntax-rules ()
    ((define-structure-type name field ...)
       (field ...)
       (structure-type-maker name)
       ((structure-type-accessor name field) ...)
       ((structure-type-setter name field) ...)))))

[ (structure-type-maker <name>) expands into make-<name>. ]

Unfortunately, (structure-type-maker name) doesn't get expanded until
it ends up as argument to define at which point Scheme royally screws
up in a totally unexpected way.

(BTW: Neither syntax-case nor explicit renaming will let me use
      structure-type-maker either, even though for different reasons

So, is there a way to get structure-type-maker expanded before
define-structure-aux gets expanded?  Any help would be much appreciated.

Please re-convince me Scheme macros are beautiful!

Cheers =8-} Mike

Mon, 14 Sep 1998 03:00:00 GMT  
 The woes of Scheme macros - HELP!
I'm not sure if you'll find an answer (or if you already know
it), but  you may have a look at the brilliant book of
Christian Queinnec, Les Langages  LISP, chapter 9: Macrologie
, Intereditions,Paris 94

Mon, 14 Sep 1998 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Scheme macro source: rewriter-widget, a widely applicable macro interface

2. Help with macros writing macros in Bigloo

3. help sought for macro defining macro

4. A macro involving two sub-macros - where the 2nd macro needs results from the first

5. Metaprogramming: C++ templates vs Scheme macros?

6. Haskell functions as CL/Scheme macros

7. Macros in scheme-style syntax

8. Macros in Common Lisp, Scheme, and other languages

9. Scheme R4RS Macros

10. lecture notes on macro's in scheme?

11. Macros in MIT Scheme

12. Macro's in MIT Scheme


Powered by phpBB® Forum Software