unofficial mirror of 
 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 --]


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


[-- 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 <> | GNU LilyPond
Freelance IT | Avatar®

^ 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 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror 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/ \
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:

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