guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: binary-port?


From: Ludovic Courtès
Subject: Re: binary-port?
Date: Sun, 24 Apr 2011 15:03:01 +0200
User-agent: Gnus/5.110015 (No Gnus v0.15) Emacs/23.3 (gnu/linux)

Hi Marco,

Marco Maggi <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]