Subject: (resolve-r6rs-interface '(srfi 160 u8) tries to load (srfi srfi-160)

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 23 Nov 2023 14:45:23 -0500

Hello,

While working on integrating SRFI 178, I've encountered the following
problem:

--8<---------------cut here---------------start------------->8---
Backtrace:
In system/base/compile.scm:
     53:4 19 (call-once #<procedure 7f77d26e94c0 at system/base/comp?>)
In ice-9/boot-9.scm:
  1755:12 18 (with-exception-handler #<procedure 7f77d65faf00 at ic?> ?)
In system/base/compile.scm:
    69:11 17 (_)
   190:11 16 (_ #<closed: file 7f77d35f78c0>)
    309:6 15 (read-and-compile #<input: srfi/srfi-178.sld 15> #:from ?)
   331:39 14 (with-compiler #<<language> name: scheme title: "Schem?> ?)
   261:27 13 (_ #<syntax:srfi-178.sld:1:0 (#<syntax:srfi-178.sld:1:?> ?)
In ice-9/boot-9.scm:
   2919:4 12 (save-module-excursion #<procedure 7f77d660c200 at lang?>)
In language/scheme/compile-tree-il.scm:
    31:15 11 (_)
In ice-9/psyntax.scm:
  1229:36 10 (expand-top-sequence (#<syntax:srfi-178.sld:1:0 (#<sy?>) ?)
  1121:20  9 (lp (#<syntax:srfi-178.sld:1:0 (#<syntax:srfi-178.sld?>) ?)
  1342:32  8 (syntax-type (#<syntax:r6rs-libraries.scm:291:12 li?> ?) ?)
  1562:32  7 (expand-macro #<procedure 7f77d64d1d30 at ice-9/r6rs-l?> ?)
In ice-9/r6rs-libraries.scm:
   304:14  6 (_ #<syntax:r6rs-libraries.scm:291:21 srfi> (#<syntax?>) ?)
In ice-9/boot-9.scm:
   222:29  5 (map1 (#<syntax:srfi-178.sld:2:10 (#<syntax:srfi-178?> ?))
   222:29  4 (map1 (#<syntax:srfi-178.sld:3:10 (#<syntax:srfi-178?> ?))
   222:29  3 (map1 (#<syntax:srfi-178.sld:4:10 (#<syntax:srfi-178?> ?))
   222:17  2 (map1 (#<syntax:srfi-178.sld:5:10 (#<syntax:srfi-178.s?>))
   3413:6  1 (resolve-interface (srfi srfi-160) #:select _ #:hide _ # ?)
  1676:22  0 (lp 0)

ice-9/boot-9.scm:1676:22: In procedure lp:
no code for module (srfi srfi-160)
--8<---------------cut here---------------end--------------->8---

Indeed, there's no such (srfi 160) module in SRFI 160, but why is it
loaded in the first place?  My srfi-178.sld R7RS library imports:

--8<---------------cut here---------------start------------->8---
(define-library (srfi 178)
  (import (scheme base))
  (import (scheme case-lambda))
  (import (srfi 151))
  (import (srfi 160 u8))
  ...
--8<---------------cut here---------------end--------------->8---

There seems to be something that doesn't work as expected in the (ice-9
r6rs-libraries) module:

--8<---------------cut here---------------start------------->8---
(resolve-r6rs-interface '(srfi 160 u8))
ERROR: no code for module (srfi srfi-160)
--8<---------------cut here---------------end--------------->8---

(srfi 160) should not be loaded; it's (srfi 160 u8) that is requested.

-- 
Thanks,
Maxim