Next: using libraries paths, Previous: using libraries intro, Up: using libraries [Index]
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:
(sample)
causes Vicare to look for a binary
file named sample.fasl and a source file named
sample.vicare.sls or sample.sls.
(yoyodyne sample)
causes Vicare to look for a
directory named yoyodyne, and within that a binary file named
sample.fasl and a source file named sample.vicare.sls or
sample.sls. The library
form for this library must
still specify the library name as (yoyodyne sample)
, not
(sample)
.
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.
(lib)
,
and additional optional extensions named (lib extras)
and
(lib frills)
.
Although the previous packaging method can be used, Vicare allows us to use a simpler technique where the main library is stored in lib/main.sls, and the extensions are stored in lib/extras.sls and lib/frills.sls, respectively.
When the the command line option --more-file-extensions is used
and the library (a b c)
is imported in source form:
/a/b/c
.
/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: using libraries paths, Previous: using libraries intro, Up: using libraries [Index]