From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: [patch] variable datums with syncase transformer
Date: Wed, 05 Mar 2008 15:59:37 +0100 [thread overview]
Message-ID: <878x0x5i92.fsf@gnu.org> (raw)
In-Reply-To: 1197619616.5218.34.camel@nocandy.dyndns.org
Hi,
I just rediscovered this message, sorry for the long delay.
Stephen Compall <s11@member.fsf.org> writes:
> Issue most easily explained with a simple reproduction:
>
> guile> (use-syntax (ice-9 syncase))
> guile> (@ (guile) car)
> ERROR: invalid syntax #<variable b7c50a40 value: #<primitive-procedure car>>
OTOH, you can (should?) use `use-modules':
guile> (use-modules (ice-9 syncase))
guile> (define-syntax foo (syntax-rules () ((_ x ...) (x ...))))
guile> foo
#<macro! sc-macro>
guile> (foo + 2 3)
5
guile> (@ (guile) car)
#<primitive-procedure car>
I don't even understand what the difference is between using
`use-modules' and `use-syntax' for `(ice-9 syncase)'. There's this
`expansion-eval-closure' fluid that's being used, but it doesn't seem to
change the module where top-level bindings are resolved, as one might
think:
guile> (define-module (x) :use-syntax (ice-9 syncase))
#<directory (x) b7a7d110>
guile> (define (+ . args) 'plus)
guile> (define-syntax foo (syntax-rules () ((_ x ...) (+ x ...))))
guile> (export-syntax foo)
guile> (foo 1 2 3)
plus
guile> (set-current-module (resolve-module '(guile-user)))
#<directory (x) b7a7d110>
guile> (use-modules (x))
guile> (foo 1 2 3)
6 ;; <--- `+' is resolved in `(guile-user)', not in `(x)'
This per-module syntax transformer, `use-syntax' and friends all look
pretty pointless to me.
Thanks,
Ludovic.
next prev parent reply other threads:[~2008-03-05 14:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 8:06 [patch] variable datums with syncase transformer Stephen Compall
2008-03-05 14:59 ` Ludovic Courtès [this message]
2008-03-05 15:36 ` Stephen Compall
2008-03-05 16:34 ` Ludovic Courtès
2008-03-05 20:55 ` Neil Jerram
2008-03-05 22:16 ` Stephen Compall
2008-03-05 23:21 ` Ludovic Courtès
2008-03-06 23:28 ` Neil Jerram
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=878x0x5i92.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@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).