unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: prj@case.edu (Paul Jarc)
To: guile-user@gnu.org
Subject: defining macros within eval
Date: Sun, 16 Oct 2022 05:39:07 -0400	[thread overview]
Message-ID: <ozkdlepgcdl0.fsf@webapps-d-2.tis.cwru.edu> (raw)

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>

The error happens for define-syntax-rule and define-macro, but not
plain define.  It happens when eval is within begin or let, but not at
the top level.  Is there some way to make this work?  In my real code,
the expression is read from a file, where it might be a macro
definition or anything else, and it's evaluated in a different module
from the current one.



             reply	other threads:[~2022-10-16  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16  9:39 Paul Jarc [this message]
2022-10-16 14:07 ` defining macros within eval Jean Abou Samra
2022-10-16 16:21   ` Maxime Devos
2022-10-16 16:13 ` Maxime Devos
2022-10-16 16:17 ` Maxime Devos
2022-10-19  8:42   ` Paul Jarc
2022-10-19 17:36     ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ozkdlepgcdl0.fsf@webapps-d-2.tis.cwru.edu \
    --to=prj@case.edu \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).