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: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.1-40-g2252321 Date: Wed, 08 Jun 2011 22:52:56 +0200 Message-ID: <87d3ioxcyf.fsf@gnu.org> References: <87liyhe047.fsf@gnu.org> <87pqnmb331.fsf@gmx.at> <871v0118fp.fsf@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1307567096 10769 80.91.229.12 (8 Jun 2011 21:04:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2011 21:04:56 +0000 (UTC) Cc: guile-devel@gnu.org To: Andreas Rottmann Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 08 23:04:49 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 1QUPvk-0004No-DU for guile-devel@m.gmane.org; Wed, 08 Jun 2011 23:04:48 +0200 Original-Received: from localhost ([::1]:45393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUPvj-0007dY-BZ for guile-devel@m.gmane.org; Wed, 08 Jun 2011 17:04:47 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUPkO-0004ii-HO for guile-devel@gnu.org; Wed, 08 Jun 2011 16:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUPkM-0000qs-Hs for guile-devel@gnu.org; Wed, 08 Jun 2011 16:53:04 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:53604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUPkM-0000qf-2K for guile-devel@gnu.org; Wed, 08 Jun 2011 16:53:02 -0400 Original-Received: from nixey (reverse-83.fdn.fr [80.67.176.83]) (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 7CB8F44050; Wed, 8 Jun 2011 22:53:00 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 20 Prairial 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: <871v0118fp.fsf@gmx.at> (Andreas Rottmann's message of "Sat, 14 May 2011 19:46:50 +0200") User-Agent: Gnus/5.110017 (No Gnus v0.17) Emacs/24.0.50 (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:12563 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Andreas, (Sorry for the laaaate reply, I'm just slowly catching up.) Andreas Rottmann skribis: > Andreas Rottmann writes: > >> ludo@gnu.org (Ludovic Court=E8s) writes: >> >>> Hi Andreas, >>> >>> Thanks for taking care of this, and thanks for the great doc too! >>> >>> "Andreas Rottmann" writes: >>> >>>> commit 2252321bb77fe83d98d5bcc9db1c76b914e9dd6a >>>> Author: Andreas Rottmann >>>> Date: Sat May 7 23:40:14 2011 +0200 >>>> >>>> Make the R6RS simple I/O library use conditions >>>>=20=20=20=20=20 >>>> * module/rnrs/io/ports.scm (display): Implement as an >>>> exception-converting wrapper around Guile's core display. >>>> * module/rnrs/io/simple.scm: Don't export Guile's corresponding co= re >>>> procedures, but use `(rnrs io ports)' instead. This way, we get= the >>>> conditions required by R6RS raised. >>>>=20=20=20=20=20 >>>> * doc/ref/r6rs.texi (rnrs io simple): Mention that these procedure= s are >>>> supposed to raise R6RS conditions. >>> >>> Could you add one or more test cases? >>> >> I've started to hack on this, aiming for at least providing tests of a >> "control sample" of exception-related behaviors in `(rnrs io simple)' >> and parts of `(rnrs io ports)'. However, as this is already >> significantly more than one test, it may take a bit. I could however >> push my existing work at any point, if that's needed for any reason. >> > I've now pushed a first patch (b6a66c2), in the process fixing two bugs. > These were not directly related to the simple I/O change you referenced, > but located in its base library `(rnrs io ports)'. --=-=-= Content-Type: text/x-patch Content-Disposition: inline +(define (with-i/o-port-error port make-primary-condition thunk) + (with-throw-handler 'system-error + thunk + (lambda args + (let ((errno (system-error-errno args))) + (if (memv errno (list EIO EFBIG ENOSPC EPIPE)) + (raise (condition (make-primary-condition) + (make-i/o-port-error port))) + (apply throw args)))))) + +(define-syntax with-textual-output-conditions + (syntax-rules () + ((_ port body0 body ...) + (with-i/o-port-error port make-i/o-write-error + (lambda () (with-i/o-encoding-error body0 body ...)))))) [...] (define (put-char port char) - (with-i/o-encoding-error (write-char char port))) + (with-textual-output-conditions port (write-char char port))) (define (put-datum port datum) - (with-i/o-encoding-error (write datum port))) + (with-textual-output-conditions port (write datum port))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'm a bit concerned about the performance implications of the above change: =E2=80=98put-char=E2=80=99, =E2=80=98put-datum=E2=80=99, etc. now e= xpand to something like (with-i/o-port-error p xxx (lambda () (with-throw-handler 'decoding-error (lambda () (write-char c p)) (lambda (key subr message errno port) (raise (make-i/o-decoding-error port)))))) So there are at least 4 additional function calls (2 =E2=80=98with-throw-handler=E2=80=99 calls, and 2 anonymous closure calls.) Did you do any measurements? Would be nice to add micro-benchmarks under benchmark-suite/. One optimization would be to instead do something such that =E2=80=98put-ch= ar=E2=80=99 would expand to something like: (define (put-char p c) (with-throw-handler #t (lambda () (write-char c p)) (lambda args (case (car args) ((decoding-error) (raise (make-i/o-decoding-error p))) ((system-error) (if (memv (system-error-errno args) `(,EIO ,EFBIG ,ENOSPC ,EPIPE)) ...)) (else ;; Not for us. (apply throw args)))))) What do you think? Thanks, Ludo=E2=80=99. --=-=-=--