[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this a bug?
From: |
Mark H Weaver |
Subject: |
Re: Is this a bug? |
Date: |
Mon, 22 Aug 2011 18:47:37 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
address@hidden wrote:
> ---[ woe.scm ]---
>
> (define-syntax without-exception
> (syntax-rules ()
> ((without-exception key thunk ...)
> (catch key (lambda () thunk
> ...)
> (lambda (a .
> r) #f)))))
>
> ---[ test.scm ]---
>
> (load "woe.scm")
> (without-exception #t (display "toto\n"))
>
> ---[ EOF ]---
[...]
> /home/rixed/src/sact.junkie/test.scm:2:0: In procedure #<procedure 19cc700
> ()>:
> /home/rixed/src/sact.junkie/test.scm:2:0: Wrong type to apply:
> #<syntax-transformer without-exception>
>
> This code used to work on guile 1.8, so what's wrong with it?
The problem is that the compiler, while compiling test.scm, sees no
syntax declaration of `without-exception', and therefore assumes that
`without-exception' is simply a top-level variable.
A simple workaround is to use `(include "woe.scm")'. I don't know the
full details, but my understanding is that unlike `load', `include'
causes the compiler to look for syntax declarations in the included
file.
Another solution (though guile-specific) is to make woe.scm a guile
module, and to use `use-modules' to import it.
Best,
Mark
- Is this a bug?, rixed, 2011/08/16
- Re: Is this a bug?,
Mark H Weaver <=