bug#66046: Relative includes in R7RS define-library seem broken

Timothy Sample <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Hi Daphne,

Daphne Preston-Kendal <[email protected]> writes:

> A standard layout for R7RS libraries is to have an .sld file
> containing the library import and export declarations with a parallel
> .scm file with the same name in the same directory, which the .sld
> file (include ...)s.
>
> [...]
>
> Guile supports looking for .sld files before .scm files if started in
> --r7rs mode. However, in this case, it will not find the .scm file if
> it’s included from the .sld file.

This is currently causing me problems, too, so I will look into writing
and submitting a patch.

We are technically following R7RS, which says the lookup strategy is
“implementation-specific”.  However, it goes on to say: “implementations
are encouraged to search for files in the directory which contains the
including file [...].”  This is perfectly reasonable, and like you say,
part of an established pattern for portable code.

> Changing the path in the include declaration to be absolute fixes the
> problem, but then it no longer works on other people’s machines.

FWIW, I’ve settled on this (annoying) pattern for now:

    (cond-expand
     (guile
      (import (only (guile) include-from-path))
      (begin (include-from-path "relative/from/load/path/foo.scm")))
     (else
      (include "foo.scm")))

I wouldn’t bother with it if I weren’t committed to Guile, though!


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