[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What are the long-term goals for R7RS in Chicken?

From: Lassi Kortela
Subject: Re: What are the long-term goals for R7RS in Chicken?
Date: Sun, 18 Jul 2021 21:19:42 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

Note that include-files and loaded libraries are two different things,
also in CHICKEN, libraries are usually compiled, so the .sld convention
is only partially useful.

The convention (observed at least by Chibi, Gambit, and Gauche) is that each .sld file contains one define-library form.

Gambit can compile something like hello.sld:

(define-library (hello)
  (import (scheme base))
  (begin (write-string "Hello world\n")))

into an object file hello.o1 via "gsc hello.sld". The gsi interpreter can load either the original hello.sld or the compiled hello.o1. (I'm not sure why it appends a running number to the ".o" suffix.) The same arrangement would probably work for Chicken.

The code to implement simple libraries is often written directly into the .sld file itself. Complex libraries tend to have the implementation parcelled out into one or more separate .scm files, which are (include "...") from the .sld file. Non-portable files may be included via cond-expand.

(include "...") must always specify the file name extension of the file being included, though in practice that tends to always be ".scm". The file foo/bar.sld files is imported via (import (foo bar)) and the import never specifies the file name extension; ".sld" is implied, though something else could be used as well; R6RS tends to use ".sls".

IMHO Gambit's R7RS support is simple, works well, and would probably be a reasonable model for Chicken.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]