From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Rottmann <a.rottmann@gmx.at>
Cc: guile-devel@gnu.org
Subject: Re: binary-port?
Date: Tue, 26 Apr 2011 17:00:32 +0200 [thread overview]
Message-ID: <871v0pkqgf.fsf@gnu.org> (raw)
In-Reply-To: <87liyxj28h.fsf@gmx.at> (Andreas Rottmann's message of "Tue, 26 Apr 2011 02:16:46 +0200")
Hi Andreas,
Andreas Rottmann <a.rottmann@gmx.at> writes:
> Well, I'm not advocating making them disjoint in the sense that the
> textual or binary operations are only possible on "matching" ports.
> Allowing to mix binary and textual I/O on any port, is, IMHO, a fine and
> reasonable implementation-specific extension that Guile provides. What
> I'm after is making `textual-port?' and `binary-port?' establish a
> partition on the set of possible ports; i.e.
>
> (textual-port? X) = (not (binary-port? X))
>
> for any port X (or at least for any port obtainable via R6RS-specified
> procedures). For that to work, we somehow need to distinguish between
> Latin-1 ports and "pure" binary ports. Perhaps by adding a flag
> indicating this to the port objects? This flag would then be set by all
> R6RS procedures specified to create binary ports, and would be checked
> by `binary-port?' and `textual-port?'. Additionally, we might want to
> clear that flag when the port's encoding is changed to non-#f. WDYT?
I think we could just as well change ‘textual-port?’ to
(define (textual-port? p) (not (binary-port? p)))
So you would have the illusion of disjoint types, with the important
difference that:
1. All I/O operations can be used on all ports.
2. Using textual operations or ‘set-encoding!’ irreversibly makes a
port pass ‘textual-port?’ if it didn’t already.
WDYT?
Thanks,
Ludo’.
prev parent reply other threads:[~2011-04-26 15:00 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 ` binary-port? Ludovic Courtès
2011-04-25 14:20 ` binary-port? Andy Wingo
2011-04-26 0:16 ` binary-port? Andreas Rottmann
2011-04-26 15:00 ` Ludovic Courtès [this message]
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=871v0pkqgf.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).