From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: binary-port? Date: Tue, 26 Apr 2011 17:00:32 +0200 Message-ID: <871v0pkqgf.fsf@gnu.org> References: <871v0tudjg.fsf@gnu.org> <87sjt9agb5.fsf@gmx.at> <87liz0yc5l.fsf@gnu.org> <87hb9mwnnd.fsf@gmx.at> <8739l6mnir.fsf@gnu.org> <87liyxj28h.fsf@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1303830052 15814 80.91.229.12 (26 Apr 2011 15:00:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Apr 2011 15:00:52 +0000 (UTC) Cc: guile-devel@gnu.org To: Andreas Rottmann Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 26 17:00:48 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QEjkt-0002LN-C5 for guile-devel@m.gmane.org; Tue, 26 Apr 2011 17:00:47 +0200 Original-Received: from localhost ([::1]:51302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEjks-0005Wl-W1 for guile-devel@m.gmane.org; Tue, 26 Apr 2011 11:00:46 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEjkp-0005WV-K1 for guile-devel@gnu.org; Tue, 26 Apr 2011 11:00:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEjkj-00035B-S1 for guile-devel@gnu.org; Tue, 26 Apr 2011 11:00:43 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:47931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEjkj-00034z-Nk for guile-devel@gnu.org; Tue, 26 Apr 2011 11:00:37 -0400 Original-Received: from nixey (unknown [193.50.110.208]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id 68CB64436D; Tue, 26 Apr 2011 17:00:36 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 =?iso-8859-1?Q?Flor=E9al?= an 219 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <87liyxj28h.fsf@gmx.at> (Andreas Rottmann's message of "Tue, 26 Apr 2011 02:16:46 +0200") User-Agent: Gnus/5.110015 (No Gnus v0.15) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 80.67.169.19 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12352 Archived-At: Hi Andreas, Andreas Rottmann 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) =3D (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 =E2=80=98textual-port?=E2=80=99 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 =E2=80=98set-encoding!=E2=80=99 irreversib= ly makes a port pass =E2=80=98textual-port?=E2=80=99 if it didn=E2=80=99t already. WDYT? Thanks, Ludo=E2=80=99.