Next: , Previous: , Up: using libraries   [Index]


2.4.2 File names from library references

A library is a file with the same name as the last component of the library name. For example, the library (sample) will correspond to a source file named sample.vicare.sls or sample.sls and a binary file named sample.fasl somewhere in the file system. The file extension .sls stands for “Scheme Library Source” and .fasl stands for “FASt Loading”.

NOTE For source libraries written for Vicare: the file extension to be preferred is .vicare.sls. For source libraries written for R6RS implementations: the file extension to be preferred is .sls.

NOTE Vicare will also accept the extensions .ss and .scm when the command line option --more-file-extensions is used.

Here is an example of each case:

By default, Vicare attempts to import the library (a b c) in binary format as follows: build the file “stem” /a/b/c then append the string .fasl to the stem. It attempts to import the library (a b c) from source as follows: build the file “stem” /a/b/c then append each of the following strings to the stem: .vicare.sls, .sls. Directories from the search paths are prepended to the file stem plus extension and searched on the file system, stopping at the first match.

There are two refinements of the library search algorithm for source libraries, which are performed when the --more-file-extensions command line option is used.

When the the command line option --more-file-extensions is used and the library (a b c) is imported in source form:

  1. The file “stem” is built: /a/b/c.
  2. Each of the following strings is appended to the stem, in order, until a matching file is found:
    /main.vicare.sls
    /main.vicare.ss
    /main.vicare.scm
    /main.sls
    /main.ss
    /main.scm
    .vicare.sls
    .vicare.ss
    .vicare.scm
    .sls
    .ss
    .scm
    

if there is no match, then the import request fails.

Whenever the library name component main appears as last and not unique component: when building the file stem such component is “quoted” by appending an underscore character; examples:

(alpha beta main)       ⇒ "alpha/beta/main_"
(main alpha)            ⇒ "main/alpha"
(main)                  ⇒ "main"

Next: , Previous: , Up: using libraries   [Index]