From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Make `get-datum' conform more closely to R6RS semantics Date: Tue, 06 Nov 2012 20:55:41 +0100 Message-ID: <87txt25ww2.fsf@delenn.home.rotty.xx.vu> References: <1352073544-24166-1-git-send-email-a.rottmann@gmx.at> <87objceixe.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1352231866 17096 80.91.229.3 (6 Nov 2012 19:57:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 Nov 2012 19:57:46 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Nov 06 20:57:55 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TVpHW-0007fV-Eb for guile-devel@m.gmane.org; Tue, 06 Nov 2012 20:57:54 +0100 Original-Received: from localhost ([::1]:46123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVpHN-0004Fu-J1 for guile-devel@m.gmane.org; Tue, 06 Nov 2012 14:57:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVpHJ-0004Fm-Lc for guile-devel@gnu.org; Tue, 06 Nov 2012 14:57:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVpHD-0001Ak-J5 for guile-devel@gnu.org; Tue, 06 Nov 2012 14:57:41 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:53769) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TVpHD-0001AY-9e for guile-devel@gnu.org; Tue, 06 Nov 2012 14:57:35 -0500 Original-Received: (qmail invoked by alias); 06 Nov 2012 19:57:32 -0000 Original-Received: from 85-127-112-13.dynamic.xdsl-line.inode.at (EHLO cubox.home.rotty.xx.vu) [85.127.112.13] by mail.gmx.net (mp036) with SMTP; 06 Nov 2012 20:57:32 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX1+LmZEye5iL4R5sudkIPiRgM3KL9hJmfJk0fTeNa1 Pw43cwZA/vtGpZ Original-Received: from delenn.lan (unknown [192.168.2.11]) by cubox.home.rotty.xx.vu (Postfix) with ESMTP id 228D11600B3; Tue, 6 Nov 2012 20:55:42 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id E3F32320140; Tue, 6 Nov 2012 20:55:41 +0100 (CET) In-Reply-To: <87objceixe.fsf@tines.lan> (Mark H. Weaver's message of "Mon, 05 Nov 2012 00:07:57 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.165.64.22 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:15115 Archived-At: Mark H Weaver writes: > Hi Andreas, > > Andreas Rottmann writes: >> * module/rnrs/io/ports.scm (get-datum): Set reader options to be more >> compatible with R6RS syntax. >> >> With Guile's default reader options, R6RS hex escape and EOL escape >> behavior is missing. This change enables the former via the >> `r6rs-hex-escapes' option, and gets us closer to the latter by setting >> `hungry-eol-escapes'. >> >> * test-suite/tests/r6rs-ports.test ("8.2.9 Textual input")["get-datum"]: >> New tests. >> --- >> module/rnrs/io/ports.scm | 13 +++++++++++-- >> test-suite/tests/r6rs-ports.test | 28 ++++++++++++++++++++++++++++ >> 2 files changed, 39 insertions(+), 2 deletions(-) >> >> [... patch elided ... ] > > The problem with the approach above is that it sets the read options > globally, which is obviously a bad idea in a multithreaded program. > Oops, yes. I was under the impression that the read options are stored in a fluid, but I didn't verify that assumption. > Until very recently there was no other practical option, but now 'read' > starts by building a private struct 'scm_t_read_opts' and passes it down > to all the helper functions explicitly. This was partly what enable > per-port read options, which are now supported internally and accessible > using reader directives such as #!fold-case, #!no-fold-case, and > #!curly-infix. It also means that it is now feasible to provide another > 'read' procedure that accepts a set of read options explicitly. > > I've been avoiding adding a public API for this, because I feel that the > current 'read-options' API is poorly-designed and I'd rather take the > opportunity to come up with a clean design. > > For now, I suggest that we add 'get-datum' as a C function in read.c, > which initializes the 'scm_t_read_opts' as needed for R6RS. > Yup, I've seen that change while skimming over recent changes in stable-2.0, and have come to the conclusion that a solution that would directly call `read' with an R6RS set of options would be better. My patch has originated some way back -- I'll rework it along the lines of your proposal. > Also, while we're on the subject, now that we have per-port read > options, perhaps #!r6rs ought to set some of them instead of being a > no-op. See 'scm_read_shebang' in read.c. > Yep, I think that's a good idea. This can also spare us from setting them as part of an --r6rs command-line option, which I suggested in the %load-extensions thread . Regards, Rotty -- Andreas Rottmann --