unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#47245: re-defining imported symbol to itself fails
@ 2021-03-18 16:51 Jan Nieuwenhuizen
  0 siblings, 0 replies; only message in thread
From: Jan Nieuwenhuizen @ 2021-03-18 16:51 UTC (permalink / raw)
  To: 47245

[-- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-18 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 16:51 bug#47245: re-defining imported symbol to itself fails Jan Nieuwenhuizen

unofficial mirror of bug-guile@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-bugs/0 guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ https://yhetil.org/guile-bugs \
		bug-guile@gnu.org
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.bugs
	nntp://news.gmane.io/gmane.lisp.guile.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git