Re: Cyclic ports from other ports, truncating the input?
Jeronimo Pellegrini 11 Jul 2026 00:01 UTC
On 2026-07-10 13:23, Wolfgang Corcoran-Mathe wrote:
> On 2026-07-10 09:16 -0300, Jeronimo Pellegrini wrote:
>> By the way... Regarding string and bytevectors, maybe it would be
>> possible to adopt option (1) anove, or: restrict the operation to
>> the immutable ones? Or (but breaking the principle of least
>> surprise, so not good) automatically make the string o bytevector
>> immutable when preparing the cyclic port?
>
> Adopting (1) in the string and bytevector cases would be equivalent to
> saying that these procedures operate on a copy of their arguments, thus
> guaranteeing that later argument mutation won't affect cyclic port
> output. I was going to make this change, but realized that, in R6 and
> R7, the effect of mutating the argument of 'open-string-input-port',
> 'open-input-string', etc. is explicitly left unspecified. (See R7RS
> §6.13.1 and R6RS standard libraries §8.2.7.) I think the SRFI should
> probably follow the Reports here.
>
> It would be nice to restrict string and bytevector input ports to
> immutable inputs in general. But of course no Report has yet given us
> a way to create or detect an immutable object.
Yes, right.
So - you convinced me that it is indeed not worth doing after all.
J.