chicken-users
[Top][All Lists]
Advanced

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

Conditional include


From: Lassi Kortela
Subject: Conditional include
Date: Sun, 18 Jul 2021 17:16:04 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

Lassi: The fact that different Schemes have different conventions for where their library files are is actually a great convenience to me when developing SRFIs.  All the actual code goes into files named *-impl.scm (or multiple names if there are multiple files).  Then each library file or equivalent, which is where the differences are concentrated, is in an implementation-specific place.  The library file for (foo bar) will be at:

Chibi:  foo/bar.sld
Chicken: foo.bar.scm
Guile: foo/bar.scm
Ypsilon: foo/bar.sls, or foo/bar.ypsilon.sls if it is Ypsilon-specific

And since each of these needs to be slightly different, that's a Good Thing.

This is suboptimal: the meaning is obscured, and things work by accident since you have only 4 Schemes and all of them happen to use different naming conventions. If you add more Schemes, some of them will eventually clash.

R6RS implementations have a convention of appending the implementation's name to the filename. For example, <https://github.com/arcfide/chez-srfi/tree/master/%253a39> has the files:

parameters.sls  ; Portable version of the code.
parameters.chezscheme.sls
parameters.ikarus.sls
parameters.ironscheme.sls
parameters.mzscheme.sls
parameters.ypsilon.sls

This is clearer and more likely to avoid clashes.

Best of all is the R7RS solution:

(define-library (foo)
  (cond-expand (chicken (include "foo.chicken.scm"))))



reply via email to

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