guile-user
[Top][All Lists]
Advanced

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

Re: error Wrong type to apply: #<syntax-transformer


From: Jean Abou Samra
Subject: Re: error Wrong type to apply: #<syntax-transformer
Date: Thu, 03 Aug 2023 11:58:42 +0200
User-agent: Evolution 3.48.4 (3.48.4-1.fc38)

> overload.scm must be before some definitions of scheme-infix.scm even
> if it is not used here, it is strange, i do not understand all but it
> compiles now


A minimal reproducer for your problem is

(define (foo)
  (bar 'quux))
(define-syntax-rule (bar x) x)
(display (foo))



Let's dissect what happens. At macro expansion time (during byte compilation),
first the definition of foo is expanded. bar is unbound, so it's compiled as a
function call. Then comes the definition of bar as a macro, but foo has already
been expanded without it.

At runtime, a macro is bound to a syntax transformer, so the binding for bar
that was unresolved at expand time gets resolved to the toplevel binding that
gets defined for bar, and you get this error because a macro transformer can't
be called as  a function.


Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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