Skip to content

In-collection library lookup only works for file with .rkt extension #12

@rvs314

Description

@rvs314

I'm trying to write an R6RS library that is compatible with Racket's R6RS mode, but I'm having an issue getting the path resolution behavior working. Suppose I have the following directory structure, where the absolute path to the egg-sample directory is in current-library-collection-paths:

egg-sample/
├── lib1.scm
└── lib2.scm

If I attempt to (import (rnrs) (egg-sample lib2)) from within lib1, racket complains:

lib1.scm:5:17: import: cannot find suitable installed library
  at: (egg-sample lib2)
  in: (import (rnrs) (egg-sample lib2))
  location...:
   lib1.scm:5:17
  context...:
   /usr/share/racket/pkgs/r6rs-lib/r6rs/private/parse-ref.rkt:95:0: convert-library-reference
   /usr/share/racket/pkgs/r6rs-lib/r6rs/private/parse-ref.rkt:142:0: parse-import
   .../private/map.rkt:40:19: loop
   [repeats 1 more time]
   /usr/share/racket/pkgs/r6rs-lib/r6rs/main.rkt:179:0

However, if I rename lib2.scm to lib2.rkt, then it works correctly. The issue seems to be this invocation:

;; First, try specific file in collection, which works
;; when the relevant collection is spliced:
(path-replace-suffix
(apply collection-file-path (path-add-suffix file #".rkt") coll)

This checks for .rkt files, but given that this is an implementation of R6RS, shouldn't it also look for .scm/.ss/.sls files as well? Is there a better way to be going about this in general? I'd be happy to send a PR if this is indeed a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions