GNU bug report logs -
#58001
Cannot use 'read' in imported library
Previous Next
To reply to this bug, email your comments to 58001 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org:
bug#58001; Package
guile.
(Thu, 22 Sep 2022 08:06:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
author <at> will.party:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org.
(Thu, 22 Sep 2022 08:06:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I'm using Guile version 3.0.5 from the Guix repository.
I've run into a strange issue with the read function from (scheme
base). It cannot be used in an R7RS-style library. This only seems to
apply to the read function. Other standard procedures work fine.
Let's say you have a library that uses read. Maybe it looks like this:
;; File: foo.scm
(define-library (foo)
(import (scheme base))
(export read-wrapped)
(begin
(define (read-wrapped port) (read port))))
Now, let's say you want to import that library somewhere else and use
it's exported function read-wrapped:
;; File: main.scm
(import (scheme base))
(import (foo))
(display (read (current-input-port)))
(display (read-wrapped (current-input-port)))
If you try to run that main script (in the same directory as the foo
library):
GUILE_LOAD_PATH=. guile --r7rs main.scm
You can enter get a datum for the first call to read, then you'll get
an error for the second call:
foo.scm:1:0: In procedure read-wrapped:
Unbound variable: read
This only happens with read. If you replace read with a different
standard procedure like boolean? then everything is fine (you'll see #f
twice because the input port fails the predicate).
I'm pretty baffled. I've attached the dummy source files for
convenience.
[Message part 2 (text/html, inline)]
[foo.scm (text/x-scheme, attachment)]
[main.scm (text/x-scheme, attachment)]
This bug report was last modified 2 years and 332 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.