Mark,


Hmm, just realized, to add on top of what you said, method has a major thread-safety problem if the bytevector output port is accessed from more than one thread. Definitely need to fix this.


Freja Nordsiek

On Mon, Jun 19, 2017 at 8:03 AM, Mark H Weaver <mhw@netris.org> wrote:
Freja Nordsiek <fnordsie@gmail.com> writes:

> Also, I found one error in the get-output-bytevector procedure in
> (scheme base), which was that the procedure discarded the bytes
> already written. get-output-bytevector is not supposed to be
> destructive to the bytes already written, but the R6RS output
> bytevector reading procedures are destructive. I made a patch with a
> very simple fix, which is to just write the bytes back.

Ah, good catch!  I'd like to fix this in a different way though: instead
of removing the bytes and then adding them back, I'd prefer to modify
r6rs-ports.c to support this (read-only) operation directly.

     Thanks,
       Mark