Tue Sep 2 22:23:08 CEST 2008

quasiquotation and staging

quasiquotation = merging of namespaces
syntax-case does this by importing identifiers

look at oleg's paper about metaml vs. quasiquote and renaming.  maybe
the essential difference is the compile time identification of bound
names?  scheme's macro facility only makes sure that names come from
the right lexical environment, but they do not identify binding forms
and variable references.

another thing is cross stage persistence: quoted code creates
closures (variables from generation time are still available).

so, quasiquotation. apparently i got the nested version wrong:


  "The innermost comma is associated with the outermost backquote."

I found a definition of quasiquote here:


(define-syntax quasiquote
  (syntax-rules (unquote unquote-splicing quasiquote)
    (`,x x)
    (`(,@x . y) (append x `y))
    ((_ `x . d) (cons 'quasiquote       (quasiquote (x)   d)))
    ((_ ,x   d) (cons 'unquote          (quasiquote (x) . d)))
    ((_ ,@x  d) (cons 'unquote-splicing (quasiquote (x) . d)))
    ((_ (x . y) . d)
     (cons (quasiquote x . d) (quasiquote y . d)))
    ((_ #(x ...) . d)
     (list->vector (quasiquote (x ...) . d)))
    ((_ x . d) 'x)))