guile-user
[Top][All Lists]
Advanced

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

Re: defining macros within eval


From: Maxime Devos
Subject: Re: defining macros within eval
Date: Sun, 16 Oct 2022 18:17:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1



On 16-10-2022 11:39, Paul Jarc wrote:
Hi.  I'm updating some old code to work with newer versions of Guile.
This example used to work with 1.8, but gives an error with 2.2 and
later:

(begin
   (eval '(define-syntax-rule (rule x) x) (current-module))
   (display (rule "ok\n")))

ERROR: Wrong type to apply: #<syntax-transformer rule> [...]

See my previous reply, and also are you sure that 'eval' is appropriate here? Would datum->syntax + read tricks work instead?

For an example in the wild, see e.g. <https://git.gnunet.org/gnunet-scheme.git/tree/gnu/gnunet/message/protocols.scm>.

(the (include-from-path "gnu/.../protocols.scmgen" is not relevant here, you could inline protocols.scmgen in that example -- I just found separating it in a separate file a nicer structure).

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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