bug-guile
[Top][All Lists]
Advanced

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

bug#22142: A bug with define-syntax


From: Mark H Weaver
Subject: bug#22142: A bug with define-syntax
Date: Tue, 15 Dec 2015 03:19:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Tommi Höynälänmaa <address@hidden> writes:

> I get the following error message:

[...]

> ERROR: In procedure #<syntax-transformer assert>:
> ERROR: Wrong type to apply: #<syntax-transformer assert>
> make: *** [hello-world.scm] Virhe 1
> --- cut here ---
>
> The code should compile.

This error indicates, roughly speaking, that 'assert' was used before it
was defined.  More precisely: an expression that uses the 'assert' macro
was (macro-)expanded before 'assert' was defined.

This works in Guile 1.x, because it's a pure interpreter that performs
macro expansion lazily, i.e. it delays expansion of a given expression
until the first time the expression is evaluated.  This allows you to
_define_ a procedure that uses 'assert' before 'assert' is defined, as
long as the procedure is not _applied_ (i.e. called) before 'assert' is
defined.

Guile 2.x uses a new macro expander that is far superior in most
respects, but it does not support lazy expansion, and therefore strictly
requires that macros be defined before their uses are expanded.

     Regards,
       Mark





reply via email to

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