[r6rs-discuss] Question on buffer modes

From: Abdulaziz Ghuloum <aghuloum>
Date: Wed, 23 May 2007 23:20:32 -0400

On May 23, 2007, at 10:31 PM, Abdulaziz Ghuloum wrote:

>
> 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 draft says:

   Rationale: The port is fresh so it can be safely closed or
   converted to a textual port without risking the usability of
   an existing port.

But there are also some other situations where it's desirable
to be able to close the underlying standard input and standard
output ports. Returning a fresh port each times makes
(close-output-port (standard-output-port)) a no-op.

I agree that it's desirable to be able to convert a binary
port to a textual port without risking the usability of
another port. Can't this be achieved by other means? What
I'm thinking is that it should be possible to construct a
textual port from a binary port without having to destroy the
binary port first (I thought this is what r6rs was going for
but apparently it's not).

Aziz,,,
Received on Wed May 23 2007 - 23:20:32 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC