bug#70033: Possible Bug: Inconsistent Evaluation Environment

Prafulla Giri via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <K8H2FCgy3vYDCkzJRcdEHkcRmSgLXTNJfY0d3M1NWKnX9l3IGXZ7uVIooNI5VqSepmXUD6npMmSwcx81dC0Mg_U3THDTCBC3rokrbuG4wTM=@protonmail.com>
Hello there,

I have bumped into an interesting issue with GNU Guile 3.0.9 (as shipped via GNU GUIX).

Consider a file -- file1.scm -- with the following definition over-riding the built-in procedure vector-length:

(define (vector-length whatever) "over-ridden")

Now, consider another file -- file2.scm -- which makes use of this over-ridden procedure, the contents of which are:

(load "file1.scm") ; both files are in the same directory
(define (some-procedure whatever) (vector-length whatever))

Now, if one loads file2.scm with guile with:
$ guile -l file2.scm
and in the REPL tries:
>(some-procedure 'anything) ;; this is expected to return "over-ridden"
an error is thrown saying vector-length expects a vector. To make things "curiouser and curiouser"
>(vector-length 'anything) ;; returns "over-ridden", as expected.

As such, it seems that we have a situation where the evaluation environment is somewhat inconsistent.

Interestingly enough, this problem also seems to be there on GNU Guile 2.2.7 as available via GNU Guix.

Chez Scheme 9.5.8 behaves as expected: (some-procedure 'whatever) does return "over-ridden".
Likewise with TinyScheme 1.42, Scheme48 1.9.2, MIT Scheme 11.2 and even GNU Guile 1.8.8 --- all behave as expected and return "over-ridden" after evaluating (some-procedure 'whatever).

The issue does not occur if all the definitions are in the same file, however.

Perhaps this warrants further investigation.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.