ri...@happyleptic.org 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

Reply via email to