On Thursday, June 16, 2022 12:45:30 PM EDT Maxime Devos wrote: > Ludovic Courtès schreef op do 16-06-2022 om 18:18 [+0200]: > > In Guile proper, it would be nice if there were a ‘%file-name-encoding’ > > fluid. > > I was more thinking of a %file-name-encoding parameter (instead of a > fluid), but that's what I had in mind. > I think the problem goes deeper than that: an R6RS string is a fixed-length sequence of Unicode scalar values, but a path on a Unix-like system is a sequence of non-null bytes, and on Windows is a sequence of UTF-16 code units with possibly unpaired surrogates (aka WTF-16 [1]). That is, there are some valid paths that can not be represented as Scheme strings. Racket has a really nice path datatype that handles these subtleties (there are many bad headaches if you want to be portable to Windows) while allowing an ergonomic use of strings for the common case. [2] Zuo has a more minimal path API which takes advantage of the fact that a Zuo string is like a Scheme bytevector. [3] It doesn't handle all of the complexity managed by the Racket path type, but focuses on the subset of paths applicable to a build environment. The implementation of all of Zuo is a single C file. [4] -Philip [1]: https://simonsapin.github.io/wtf-8/ [2]: https://docs.racket-lang.org/reference/pathutils.html [3]: https://docs.racket-lang.org/zuo/zuo-base.html#%28part._.Paths%29 [4]: https://github.com/racket/racket/blob/master/racket/src/zuo/zuo.c