[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Encoding library names
From: |
Lassi Kortela |
Subject: |
Encoding library names |
Date: |
Sat, 20 Jul 2024 22:46:27 +0300 |
User-agent: |
Mozilla Thunderbird |
> In R7RS non-negative integers can be library name parts. Since these
library names look natural, it would be good to backport this to R6RS
implementations.
Then (library [...] (import (srfi 1)) [...]) would work, and since
‘library’ is (R6RS) standard and reasonably portable it would then
appear that (srfi 1) is (R6RS) standard and portable, whereas it isn’t
R6RS, and hence not a good idea to backport.
For the time being, (library ...) is only available in R6RS
implementations. But the next report (tentatively titled R7RS-large) is
on track to be a merger of R6RS and R7RS, and hence will most likely
support both (library ...) and (define-library ...) while merging their
semantics in some way.
I would agree that interop between strict R6RS and other dialects of
Scheme is important. To that end, the option to use numbers in R6RS
library names using the : prefix is good to have. (R6RS does not have
the vertical bar notation |123| to turn numbers into symbols, so strict
R6RS code cannot even rely on that notation to encode numerical library
name parts).
A further complication is that :123 is a keyword in some Scheme
implementations. (This syntax comes from Common Lisp and Emacs Lisp,
perhaps going as far back as Maclisp.) It might be best if any leading
colon in a library name part is simply removed.
> The colon causes endless grief when mapping library names to file names.
> For example, look at all the %3a in
> https://github.com/arcfide/chez-srfi. That's not even the worst of it.
I don’t think this is a problem for Guile? I don’t recall to what
extent, but (srfi ...) modules are somewhat special-cased in Guile (or
maybe it was integers in general for define-library) – maybe its
implementation of define-library translates (srfi 1) to (srfi srfi-1) (I
don’t recall the specifics). Hence, the file can simply be named
“srfi/srfi-1.scm”.
For compatibility, both(**) (srfi srfi-N) (ß non-standard Guile thingie)
and (srfi :N) need to be supported anyway for ‘define-module’ (ß
Guile-specific interface), so which of them determines the file name is
just a matter of convenience.
Also, AFAIK that %3a encoding isn’t necessary (and neither
recognised(^)) in Guile – I don’t think Guile does any percent
encoding(*). I think naming the file “srfi/:1.scm” would work fine,
although it’s not something I’ve tried before. (There might be a problem
with Makefile if ‘make’ doesn’t like the :, but I have some ideas for
simple ways around that.)
Guile should support non-negative integers in any library name, not only
for the SRFI libraries. R7RS allows them anywhere.
I would recommend implementing the %-encoding of arbitrary UTF-8 bytes
(several Scheme implementations do it when translating library names to
file names) but to avoid using it in practice.
The : prefixes should be stripped before encoding a library name as a
file name.
FAT, NTFS (and probably other file systems) do not allow colons in file
names. I am not aware of any file system that forbids the percent sign.
(*) implication: you can’t have two different modules (foo/bar) and (foo
bar) in Guile.
Percent-encoding the slash solves this easily.
(^) (srfi %3a1) would mean the module has literally (srfi %3a1) as name.
AFAIK that is allowed by RnRS.
- Portable code, (continued)
- Portable code, Lassi Kortela, 2024/07/20
- Re: Portable code, Dr. Arne Babenhauserheide, 2024/07/20
- Re: Portable code, Lassi Kortela, 2024/07/20
- Re: Portable code, Dr. Arne Babenhauserheide, 2024/07/20
- Re: Portable code, Lassi Kortela, 2024/07/26
- RE: Name of the standard library, Maxime Devos, 2024/07/20
- Re: Name of the standard library, Dr. Arne Babenhauserheide, 2024/07/20
- RE: Name of the standard library, Maxime Devos, 2024/07/20
- Portable imports, Lassi Kortela, 2024/07/20
- RE: Portable imports, Maxime Devos, 2024/07/20
- Encoding library names,
Lassi Kortela <=
- RE: Encoding library names, Maxime Devos, 2024/07/20
- Re: Portable imports, tomas, 2024/07/21
- RE: Portable imports, Maxime Devos, 2024/07/20
- Re: Name of the standard library, Lassi Kortela, 2024/07/20
- Re: Name of the standard library, Dr. Arne Babenhauserheide, 2024/07/20
- Re: Name of the standard library, Lassi Kortela, 2024/07/26
- RE: Name of the standard library, Maxime Devos, 2024/07/20
- Re: Name of the standard library, Lassi Kortela, 2024/07/20
- Re: Name of the standard library, MSavoritias, 2024/07/21
- Re: Name of the standard library, Dr. Arne Babenhauserheide, 2024/07/21