chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] syntax-case update?


From: Dan
Subject: [Chicken-users] syntax-case update?
Date: Fri, 11 Aug 2006 18:15:01 -0700 (PDT)

Hi all,

having recently learned syntax-case, I experienced the
following problem: a syntax-case macro defined within
a module may not call a function from the same module,
i.e.

(module mod (mac1)

  (define (f x) x)
  
  (define-syntax mac1
    (lambda (syn)
      (syntax-case syn ()
        ((orig . args)
         (with-syntax
             ((res (datum->syntax-object
                    (syntax orig)
                    (apply f (syntax-object->datum
                              (syntax args))))))
           (syntax res))))))

)

fails with an identifier-out-of-context error.

I digged up the problem, and it turns out that since
as early as version 6.9c, syntax-case supports a
(meta) prefix that does just what I want, i.e. "tells
the expander that any variable definition resulting
from the definition is to be an expand-time definition
available only on the  right-hand sides of other meta
definitions and, most importantly, to  transformer
expressions."

OTOH, syntax-case.egg seems to be stuck in 2002 with
version 6.9. Perhaps an upgrade would be beneficial?

And no, the workaround of defining f within mac1 is
not good enough, because I want to also define mac2
that calls f :)

Just trying to make a case,
Dan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]