[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mon, 25 Apr 2011 13:55:50 +0200
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
address@hidden (Ludovic Courtès) writes:
> Hi Andreas!
> Andreas Rottmann <address@hidden> writes:
>> address@hidden (Ludovic Courtès) writes:
>>> However, I’m wondering whether we should not just squarely do away with
>>> the binary/textual distinction, and just write:
>>> (define (binary-port? p) #t)
>>> What do people with experience with pure R6RS code think? Is the
>>> distinction actually used, and how?
>> I can only find one example in the code I wrote:
>> `copy-port', which works (with the probably obvious semantics), on both
>> binary and textual ports. On Guile, when `binary-port?' would return #t
>> for all ports, `copy-port' would break, losing the transcoding effect
>> you'd get when you pass two textual ports of different encodings.
> Interesting. Can you post a link to the code?
Sure, it's in `(spells ports)':
> Anyway, that’s probably enough to keep the current semantics in 2.0.
>> With the current behavior, you still have to watch the order of your
>> port type checks, testing for `binary-port?' first, whereas on systems
>> following R6RS strictly, you'd get the same behavior regardless of
>> type check order. I can live with the latter, but the former would be
>> unfortunate, IMHO.
> Do you know what Industria, Nausicaa, & co. do?
I don't have a copy of nausicaa lying around here, but in the R6RS code
I have on my machine, xitomatl/ports.sls is the only other occurance of
`binary-port?' (besides spells/ports.sls):
It's use there is in `open-compound-input-port':
;; A compound input port is a custom port which represents the logical
;; concatenation of other input ports. It starts out with an ordered
;; collection of input ports and reads from the first one until end of file
;; is reached, whereupon it reads from the second one, and so on, until end
;; of file is reached on the last of the contained input ports, and then
;; subsequent reads from the compound input port will return end of file.
;; After each component port is exhausted, it is closed. Closing a compound
;; input port closes all remaining component ports. get-position and
;; set-position! are not supported.
So, my impression is that while `binary-port?' and `textual-port?' are
not used widely, they do have their uses, and there is definitly code
out there that relies on the binary/textual distinction.
> Likewise, any idea which Schemes have disjoint binary/textual ports,
> and which don’t?
- Ikarus and Ypsilon definitly have disjoint ports.
- Racket natively has ports that will accept both binary and textual
operations, but it's R6RS support wraps these ports so that the
resulting R6RS ports are not compatible with Racket's native port
operations, but do provide the binary/textual disjointness.
These are the only implementations (besides Guile), that I'm familiar
with. Ideally, Guile's R6RS support would provide real disjointness for
binary and textual ports -- I think the only artefact that hampers this
is that there's no way to distinguish Latin-1 encoded ports from "pure"
binary ports (as both have `port-encoding' being #f).
Andreas Rottmann -- <http://rotty.yi.org/>
- binary-port?, Ludovic Courtès, 2011/04/22
- Re: binary-port?, Andreas Rottmann, 2011/04/22
- Re: binary-port?, Ludovic Courtès, 2011/04/23
- Re: binary-port?,
Andreas Rottmann <=
- Re: binary-port?, Ludovic Courtès, 2011/04/25
- Re: binary-port?, Andy Wingo, 2011/04/25
- Re: binary-port?, Andreas Rottmann, 2011/04/25
- Re: binary-port?, Ludovic Courtès, 2011/04/26