Re: Anyone to help with .sls/.sld files?
Lassi Kortela 30 Aug 2024 20:49 UTC
AFAICT the main task is that you should break down impl.generic.scm into
files like this:
generic-arg.scm
generic-let.scm
generic-lambda.scm
generic-values.scm
And then edit the library to look something like this:
(define-library (srfi 253)
(export ...)
(cond-expand
...
(gauche
(import (except (gauche base) check-arg))
(include "gauche.scm")
(include "generic-lambda.scm")
(include "generic-let.scm")
(include "generic-values.scm"))
...
(kawa
(import (kawa base))
(include "kawa.scm")
(include "generic-arg.scm")
(include "generic-let.scm"))
...
(r7rs
(import (except (gauche base) check-arg))
(include "gauche.scm")
(include "generic-lambda.scm")
(include "generic-let.scm")
(include "generic-values.scm"))))
The idea is that you build up the complete library from small blocks,
such that for each cond-expand branch each identifier is defined only once.
My illustration has surely got the details wrong, but the principle
holds. If it gets annoying to deal with too many little files, remember
Rob Pike's maxim that "A little copying is better than a little dependency."
It helps to keep things under intellectual control if there's only one
cond-expand, as in the example above. cond-expand is exactly like #ifdef
in the C language, and the same pitfalls apply. In particular, nested
#ifdef (and hence nested cond-expand) gets confusing quickly.