Shiro Kawai scripsit:

> Custom ports are very useful in practice, though I still wonder
> if it should fit in Small Scheme.  

I am beginning to agree:  I got too ambitious and I'm inventing things
rather than standardizing them.  That's usually (not always) a mistake.

> * Flushing output port is also frequently needed operation.
> 
> * How about close?  Sometimes you need to release some resource
>   upon closure of the custom port.

Correct.

> * If we have a close operation, should it be invoked when the port
>   is GCed?

Yes, I think so.  This was discussed on #scheme.

> * I'm a bit worried about it's mutation-based API.  Will we ever
>   need to alter those procedures in middle of port operation?

I hope not!

>   OTOH, the fact that these operations can be changed at any
>   time may complicate efficient implementation (any high-level
>   I/O operations has to check whether the low-level op is
>   altered or not for each character/byte.)

That's terrible.

>   If we don't need to change those procedures once they're set,
>   then it's clearer that we make them immutable, and give them
>   at construction time.

It is indeed clearer, though it suffers from the inflexibility
I mentioned in my posting.  The Builder pattern may help here
(configure a builder object, use it to construct the real and
immutable object).

-- 
Even a refrigerator can conform to the XML      John Cowan
Infoset, as long as it has a door sticker       [email protected]
saying "No information items inside".           http://www.ccil.org/~cowan
        --Eve Maler

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to