unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Rottmann <a.rottmann@gmx.at>
Cc: guile-devel@gnu.org
Subject: Re: binary-port?
Date: Mon, 25 Apr 2011 16:08:44 +0200	[thread overview]
Message-ID: <8739l6mnir.fsf@gnu.org> (raw)
In-Reply-To: <87hb9mwnnd.fsf@gmx.at> (Andreas Rottmann's message of "Mon, 25 Apr 2011 13:55:50 +0200")

Hi,

Andreas Rottmann <a.rottmann@gmx.at> writes:

> ludo@gnu.org (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)':
>
> https://github.com/rotty/spells/blob/master/spells/ports.sls

I see, thanks.

[...]

> 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.

OK.

> - 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.

So Racket really has 3 disjoint port types, right?  That looks
inconvenient to me.

> 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).

And beyond that, you can put-bytevector on any port, read-char on any
port, and so on.

I wouldn’t want the “native” port type to be disjoint from the R6RS port
types, notably because there’s no “native” equivalent to the R6RS binary
I/O API, and also because it would hamper composition of R6RS and
non-R6RS code.

Thanks,
Ludo’.



  reply	other threads:[~2011-04-25 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 22:28 binary-port? Ludovic Courtès
2011-04-23  1:48 ` binary-port? Andreas Rottmann
2011-04-23 19:56   ` binary-port? Ludovic Courtès
2011-04-24  6:39     ` binary-port? Marco Maggi
2011-04-24 13:03       ` binary-port? Ludovic Courtès
2011-04-25 11:55     ` binary-port? Andreas Rottmann
2011-04-25 14:08       ` Ludovic Courtès [this message]
2011-04-25 14:20         ` binary-port? Andy Wingo
2011-04-26  0:16         ` binary-port? Andreas Rottmann
2011-04-26 15:00           ` binary-port? Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8739l6mnir.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=a.rottmann@gmx.at \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).