Hi Marco,

Marco Maggi <marco.maggi-i...@poste.it> writes:

> Ludovic Courtès wrote:
>
>>>> However,  I’m  wondering  whether  we  should  not  just
>>>> squarely do away with the binary/textual distinction
>
> How would you handle port position?

Currently port position is in bytes for all kinds of ports (info
"(guile) Random Access").  It seems to be a valid implementation of R6
port positions, no?

[...]

>   IMHO this R6 statement:
>
>   (textual-port? port) procedure 
>   (binary-port? port) procedure 
>
>     The  textual-port?  procedure  returns  #t  if  port  is
>     textual,  and  returns  #f otherwise.  The  binary-port?
>     procedure returns  #t if port is binary,  and returns #f
>     otherwise.
>
> should be enough to derive that:
>
>   (cond ((binary-port? p)
>          ---)
>         ((textual-port? p)
>          ---))
>
> and:
>
>   (cond ((textual-port? p)
>          ---)
>         ((binary-port? p)
>          ---))
>
> must  be  equivalent;  if  they are  not,  confusion  arises
> because of violation of the rule of least surprise.

Yes, and that’s a problem.

OTOH, what I wonder is when in practice would you need to use such an
idiom, or to use these predicates at all?

Thanks,
Ludo’.

Reply via email to