GNU bug report logs - #66046
Relative includes in R7RS define-library seem broken

Previous Next

Package: guile;

Reported by: Daphne Preston-Kendal <dpk <at> nonceword.org>

Date: Sun, 17 Sep 2023 08:23:01 UTC

Severity: normal

Merged with 21613, 49452, 70778

Full log


View this message in rfc822 format

From: Timothy Sample <samplet <at> ngyro.com>
To: Daphne Preston-Kendal <dpk <at> nonceword.org>
Cc: 66046 <at> debbugs.gnu.org
Subject: bug#66046: Relative includes in R7RS define-library seem broken
Date: Mon, 06 Nov 2023 12:31:28 -0600
Hi Daphne,

Daphne Preston-Kendal <dpk <at> nonceword.org> 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




This bug report was last modified 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.