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.