guile-user
[Top][All Lists]
Advanced

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

Re: Found a bug in guile 1.6.0


From: Marius Vollmer
Subject: Re: Found a bug in guile 1.6.0
Date: 27 Dec 2002 00:08:57 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Roland Orre <address@hidden> writes:

> I found a bug when a let clause only contains a macro.
> When the clause also contains a lambda clause it works.

I don't think this is a bug in Guile, but a bug in the way you are
using procedure->macro.

The best solution is not to use procedure->macro.  Use define-macro
(or defmacro) or define-syntax.

'procedure->macro' does not generate what you probably think it does.
It creates a "non-memoizing macro", which is expanded everytime it is
executed.  The second time thru, tho, 'x' contains the internal form
of the macro invocation, which is not something that 'car' etc know
how to access.

You could try

  (define-macro (push! stack obj)
    `(set! ,stack (cons ,obj ,stack)))

but note that 'stack' is evaluated twice, which matters when you use
non-trivial setters/getters.

(Just curious: where did you learn about procedure->macro?  we don't
want people to use it.)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405



reply via email to

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