GNU bug report logs - #22142
A bug with define-syntax

Previous Next

Package: guile;

Reported by: Tommi Höynälänmaa <tommi.hoynalanmaa <at> gmail.com>

Date: Fri, 11 Dec 2015 17:29:02 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mark H Weaver <mhw <at> netris.org>
To: Tommi Höynälänmaa <tommi.hoynalanmaa <at> gmail.com>
Cc: 22142 <at> debbugs.gnu.org
Subject: bug#22142: A bug with define-syntax
Date: Tue, 15 Dec 2015 03:19:43 -0500
Tommi Höynälänmaa <tommi.hoynalanmaa <at> gmail.com> 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




This bug report was last modified 9 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.