write-bytevector, write & co. Lassi Kortela (16 Aug 2020 10:24 UTC)
Re: write-bytevector, write & co. Marc Nieper-Wißkirchen (16 Aug 2020 10:33 UTC)
Re: write-bytevector, write & co. Daphne Preston-Kendal (16 Aug 2020 10:37 UTC)
Re: write-bytevector, write & co. Marc Nieper-Wißkirchen (16 Aug 2020 10:44 UTC)
Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 11:04 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 11:46 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 11:55 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 11:59 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:06 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:25 UTC)
User-defined writers and recursive write Lassi Kortela (16 Aug 2020 12:38 UTC)
(missing)
(missing)
Re: User-defined writers and recursive write Marc Nieper-Wißkirchen (16 Aug 2020 13:32 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:26 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:33 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:50 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 12:32 UTC)
Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen (16 Aug 2020 12:35 UTC)
Re: Configuring read and write for syntax extensions Lassi Kortela (16 Aug 2020 12:44 UTC)
Re: Configuring read and write for syntax extensions Shiro Kawai (16 Aug 2020 12:53 UTC)
Re: Configuring read and write for syntax extensions John Cowan (17 Aug 2020 16:58 UTC)

Re: Configuring read and write for syntax extensions Marc Nieper-Wißkirchen 16 Aug 2020 11:59 UTC

Am So., 16. Aug. 2020 um 13:46 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:
>
> Gauche extended write to take <write-controls> with which you can configure output (similar to CL's '*print-' dynamic variables).
>
> Initially I thought using parameters but decided against it, for there's a rare case that you want to do two writes concurrently for the different purpose (e.g. you wrote your "plugin" for write and want to leave some logs to a separate port.  Naturally such logging routine is invoked in middle of main "write", but the log output doesn't want to be affected even the main 'write" is customized.)
>
> My solution is actually quite a kluge so I'm wondering if there's a better way.  Whenever `write` can't pass down the current controls directly to the recursive `write`, it associates the current controls to the port.  So concurrent write to the different port can use separate controls.

I think it is actually "the right thing" to associate write controls
with a port (so scrap my earlier suggestion to use parameter). Indeed,
we already have this for "read". The case-folding is associated with a
port, not with a particular invocation of "read". This is a good thing
because it allows signaling controls to the reader through reader
directives.

For write, it could look like:

(set-port-flag! port 'srfi-207)
(write #u8(...))

Here, the invocation of "write" would write something like
"#!srfi-207" to the port (if it is not already in that mode) and then
write the bytevector in the specified format.