From: Marius Vollmer <mvo@zagadka.ping.de>
Cc: guile-devel@gnu.org
Subject: Re: module trickery
Date: 04 Sep 2002 21:35:10 +0200 [thread overview]
Message-ID: <878z2h7dld.fsf@zagadka.ping.de> (raw)
In-Reply-To: <871y8ag1ur.fsf@becket.becket.net>
tb@becket.net (Thomas Bushnell, BSG) writes:
> Here's a simple failure case with very little trickery.
Yep, it's a real bug somewhere, and I'm afraid it is not easy to fix.
The syncase implementation that we are using assumes that there is a
single toplevel and doesn't really work well with our multiple ones.
What I think is happening is this: in order for syncase to do its job,
properties are placed on symbols. Since we have multiple global
namespaces, a symbol does not uniquely name a singel macro. So we put
that property on the variable object that is bound to the symbol in
the current module. When the property is accessed, we again consult
the variable that is bound to the symbol in the current module. This
will only work when we find the same variable both times.
However, at the time that print-two is called in your example, the
current module is (test), not (foo). Since the code in print-two is
expanded lazily, the property lookup will look in the wrong module and
find the wrong (or no) variable. This makes syncase go into a loop,
for reasons that I don't know.
A workaround is to export all macros along with the procedures that
use them. This ensures that the same variable is found regardless
what module is current. (The workaround sucks, of coure, but it
works.)
For your example:
(define-module (foo)
:use-syntax (ice-9 syncase)
:export (whoo!) ;; <- new
(define-syntax whoo!
(syntax-rules ()
((_ a b)
(set! a b))))
(define-public (print-two)
(let ((a 0))
(whoo! a 2)
(display a)))
(define-module (test))
(use-modules (foo))
(print-two)
If you can export your macros in this way, that would buy you time
until we have a real fix.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-09-04 19:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-28 23:28 module trickery Thomas Bushnell, BSG
2002-08-29 20:40 ` Marius Vollmer
2002-08-30 23:02 ` Thomas Bushnell, BSG
2002-08-31 2:58 ` Rob Browning
2002-08-31 15:01 ` Marius Vollmer
2002-09-03 21:52 ` Thomas Bushnell, BSG
2002-09-03 22:11 ` Thomas Bushnell, BSG
2002-09-04 19:35 ` Marius Vollmer [this message]
2002-09-04 20:12 ` Tom Lord
2002-09-05 16:52 ` Marius Vollmer
2002-09-04 20:14 ` Marius Vollmer
2002-09-04 22:21 ` Thomas Bushnell, BSG
2002-09-04 22:40 ` Marius Vollmer
2002-09-04 23:33 ` Thomas Bushnell, BSG
[not found] ` <87r8g9uy8d.fsf@becket.becket.net>
2002-09-05 19:37 ` Marius Vollmer
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=878z2h7dld.fsf@zagadka.ping.de \
--to=mvo@zagadka.ping.de \
--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).