chibi-scheme
chibi-scheme copied to clipboard
First stab at supporting R6RS library syntax
From the R7RS-large mailing list:
Who will add R6RS support to Chibi? (Another rhetorical question.)
I'm happy to accept patches which improve R6RS operability without significant increases to the core size. syntax-case and identifier-syntax have been added with minor core changes. The library syntax would have to use implicit phasing and probably punt on versioning. There would be some minor differences in semantics, but I believe e.g. most or all of the portable SRFI libraries would work fine. [The cool Racket libraries that I'd like to use wouldn't work because they generally use the Racket language rather than R6RS.]
Compatibility is great news for me.
If it's OK, I volunteer to try adding support for the R6 (library ...)
form as an alternative to R7 define-library
. The first draft should probably ignore phasing issues and just do a simple translation of library
to define-library
?
R6 supports library version numbers: you can write (library (name of the library goes here (1 2 3)) ...)
where (1 2 3)
is the version number, and can be zero or more nonnegative integers. (In R6 the version number can't contain symbols.) Maybe start off by ignoring the version number in Chibi?
cc @mnieper
My general thought is unless you can condense the definition into about 5 lines, I'd want to support this by allowing to swap out the (meta) language. Long term this was always the plan, along with language-controlled reader overrides, allowing for non-Scheme languages.
My hope is the new R7RS "Foundations" group can come up with a language which recognizes both define-library
and library
(Marc has an idea for expanding the former into the latter).
Currently people tend to use .sld
for R7 libs and .sls
for R6 libs, but it may not be wise to rely on that distinction long-term.
My general thought is unless you can condense the definition into about 5 lines, I'd want to support this by allowing to swap out the (meta) language. Long term this was always the plan, along with language-controlled reader overrides, allowing for non-Scheme languages.
I like the idea of being able to select different startup files in place of init-7.scm and meta-7.scm.
Oh, the 7
stands for R7RS? I always wondered what it meant.
This was already supported by the API, I just didn't provide a command-line option for it. Added.
Would it be possible to use -r <number>
for this? That would match at least Gauche and Sagittarius, making life easier for people who use multiple Schemes.
I know Chibi already has -r[<main>] - run a SRFI-22 main
but it's unlikely that people want to run a main that's just a number.
(For reference, https://github.com/schemedoc/usage)
It would be kind of weird... do you think people would use this option frequently enough on those impls that it would help? There are already a lot of more common options that are different.
I would also advise against such weird irregularity for an option.