From: Mitchell Kember <mk12360@gmail.com>
To: guile-user@gnu.org
Subject: Having trouble with syntax-source
Date: Fri, 22 Apr 2022 12:51:27 -0400 [thread overview]
Message-ID: <CAAu1b1jL=0DwNG69Z-7A_N1e6o5aarnMWthzNUUxSggBRyFE+w@mail.gmail.com> (raw)
Hi,
I'm having trouble using syntax-source in a macro.
Here's what I have:
#!r6rs
(import (rnrs (6)))
(define-syntax foo
(lambda (x)
(syntax-case x ()
((_ e)
(begin
(display (syntax-source #'e))
(newline)
#'(display (syntax-source #'e)))))))
(foo (list 1))
Displaying the syntax-source works the first time during macro
expansion, but not the second time in the result of the macro:
$ guile --no-auto-compile --r6rs test-0-guile.ss
((filename . test-0-guile.ss) (line . 13) (column . 5))
Backtrace:
2 (primitive-load "/path/to/test-0-guile.ss")
In ice-9/eval.scm:
191:35 1 (_ #f)
In unknown file:
0 (syntax-source (#<syntax list> #<syntax 1>))
ERROR: In procedure syntax-source:
In procedure syntax-source: Wrong type argument in position 1
(expecting syntax object): (#<syntax list> #<syntax 1>)
I've tried the same thing in Racket and Chez Scheme and it works fine there:
https://gist.github.com/mk12/dc5a54107e46e67d702bb377304b144f
Is there some way to fix it for Guile? (Ideally in a way that also
works for Racket and Chez, since I'm in a codebase that targets all of
them, https://github.com/mk12/sicp).
Thanks,
Mitchell
reply other threads:[~2022-04-22 16:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CAAu1b1jL=0DwNG69Z-7A_N1e6o5aarnMWthzNUUxSggBRyFE+w@mail.gmail.com' \
--to=mk12360@gmail.com \
--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).