Re: NUL-terminated strings and eof-object-terminated generators
Jakub T. Jankiewicz 10 Dec 2021 10:20 UTC
On Fri, 10 Dec 2021 08:26:09 +0100
Marc Nieper-Wißkirchen <xxxxxx@gmail.com> wrote:
> If a "string" means a piece of text, then excluding the NUL character is
> reasonable. On the other hand, if "string" means a sequence of (Unicode)
> characters, the NUL character must be allowed. An R6RS "string" conforms to
> the latter interpretation, while an R7RS "string" conforms to the former
> interpretation. Both semantic interpretations are valid. Choosing one has
> implications for interoperability, of course. R6RS can use its strings for
> data transmission in its interface for custom textual ports, R7RS cannot in
> general unless its textual files do not contain the NUL character by
> definition.
Does something like this doesn't work the same in every implementation?
(string-append "yyyy" (string #\null) "xxxx")
I was testing in Gauche, Chicken, Kawa, Gambit, Guile. They all return the
same output but null have different representation when printed, depending on
the implementation.
Are there any case (or implementation) when Scheme would return "yyyy"?
Or this is not how you create null terminated string in Scheme?
--
Jakub T. Jankiewicz, Web Developer
https://jcubic.pl/me