From: Jan Nieuwenhuizen <janneke@gnu.org>
To: 47245@debbugs.gnu.org
Subject: bug#47245: re-defining imported symbol to itself fails
Date: Thu, 18 Mar 2021 17:51:17 +0100 [thread overview]
Message-ID: <87o8fgz9q2.fsf@gnu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
Hi!
Using the attached foo.scm and bar.scm, Guile 2.2 nicely redefines
%foo and %baz:
--8<---------------cut here---------------start------------->8---
$ guild compile -L . -o foo.go foo.scm
wrote `foo.go'
17:48:10 janneke@dundal:~/src/guile/master [env]
$ guild compile -L . -o bar.go bar.scm
wrote `bar.go'
17:48:12 janneke@dundal:~/src/guile/master [env]
$ guile -C . -c '(use-modules (bar))'
foo: "foo"
baz: "baz"
17:48:16 janneke@dundal:~/src/guile/master [env]
$ guile -C . -c '(use-modules (bar))'
foo: "foo"
baz: "baz"
--8<---------------cut here---------------end--------------->8---
Guile-3.0 sets %foo to *unspecified*:
--8<---------------cut here---------------start------------->8---
$ meta/build-env meta/guild compile -L . -o foo.go foo.scm
wrote `foo.go'
17:50:03 janneke@dundal:~/src/guile/master [env]
$ meta/build-env guild compile -L . -o bar.go bar.scm
wrote `bar.go'
17:50:10 janneke@dundal:~/src/guile/master [env]
$ meta/build-env meta/guile -C . -c '(use-modules (bar))'
foo: #<unspecified>
baz: "baz"
--8<---------------cut here---------------end--------------->8---
Greetings,
Janneke
[-- Attachment #2: foo.scm --]
[-- Type: application/octet-stream, Size: 61 bytes --]
(define-module (foo)
#:export (%foo))
(define %foo "foo")
[-- Attachment #3: bar.scm --]
[-- Type: application/octet-stream, Size: 219 bytes --]
(define-module (bar)
#:use-module (foo))
(define (bar?) #f)
(define %foo (if (bar?) "bar" %foo))
(format #t "foo: ~s\n" %foo)
(define %baz "baz")
(define %baz (if (bar?) "bar" %baz))
(format #t "baz: ~s\n" %baz)
[-- Attachment #4: Type: text/plain, Size: 152 bytes --]
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
reply other threads:[~2021-03-18 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=87o8fgz9q2.fsf@gnu.org \
--to=janneke@gnu.org \
--cc=47245@debbugs.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).