chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] macro systems and chicken (long)


From: Alaric Snell-Pym
Subject: Re: [Chicken-users] macro systems and chicken (long)
Date: Tue, 8 Apr 2008 11:45:08 +0100



Yes, but this is a problem with renamed bindings introduced by
hygienic
macros. For example:

(define-syntax foo
  (syntax-rules ()
    ((_ x) (let ((tmp x)) (assert x "failed")))))



riaxpander manages this:

(use riaxpander)

(define-macro (my-assert test error)
        `(if (not ,test) (error ,error)))

(define-syntax foo
        (syntax-rules ()
                ((_ x) (let ((tmp x)) (my-assert x "failed")))))

(macroexpand '(let ((x 1)) (foo x)))


#;24> (macroexpand '(let ((x 1)) (foo x)))
((lambda (x#0) ((lambda (tmp#1) (if (not x#0) (error "failed")))
x#0)) 1)

I deliberately re-used the symbol x there, but it's neatly side-
stepped around that, as far as I can see? Or is there some more
esoteric test case I need to work out?

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4






reply via email to

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