[r6rs-discuss] Question on buffer modes

Abdulaziz Ghuloum aghuloum at cs.indiana.edu
Wed May 23 22:31:45 EDT 2007


On May 23, 2007, at 10:20 PM, R. Kent Dybvig wrote:

>> In section "8.3.2. Buffer modes", the second and
>> third paragraphs talk about ports that are connected
>> to the same mutable source, yet I'm not seeing how
>> one would actually get two ports to connect to the
>> same source to begin with.  Am I overlooking where
>> that mechanism is described in the report?
>
> In most implementations, the ports returned by multiple calls to
> standard-input-port will be connected to the same source.   
> Similarly, the
> ports returned by multiple calls to standard-output-port or
> standard-error-port may be connected to the same sink; in fact, a port
> returned by standard-output-port may be connected to the same sink  
> as a
> port returned by standard-error-port.

I just realized that these procedures return a fresh port each
time they're called.  I need to think more about how this would
affect my implementation.

> The current-output and
> current-error ports may be connected to the same sink at the time the
> program starts.  One can also get two ports to connect to the same  
> source
> or sink via custom ports.  For example, you might create two custom  
> ports
> that forward data from the same file, string, or bytevector port.

Thanks for the explanation.

Aziz,,,





More information about the r6rs-discuss mailing list