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: Fix reader options for R6RS `get-datum' Date: Fri, 14 Dec 2012 04:22:24 +0100 Message-ID: <87k3sljp1r.fsf@delenn.home.rotty.xx.vu> References: <1355057247-17885-1-git-send-email-a.rottmann@gmx.at> <87boe09w3q.fsf@tines.lan> <87txrr0xes.fsf@delenn.home.rotty.xx.vu> <874njq96iw.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1355455358 17528 80.91.229.3 (14 Dec 2012 03:22:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Dec 2012 03:22:38 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Dec 14 04:22:51 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 1TjLrK-0008Gt-Hp for guile-devel@m.gmane.org; Fri, 14 Dec 2012 04:22:46 +0100 Original-Received: from localhost ([::1]:41012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjLr7-0002sh-CE for guile-devel@m.gmane.org; Thu, 13 Dec 2012 22:22:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjLr4-0002sY-Go for guile-devel@gnu.org; Thu, 13 Dec 2012 22:22:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjLr2-0003dI-Hf for guile-devel@gnu.org; Thu, 13 Dec 2012 22:22:30 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:57479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjLr2-0003cw-7x for guile-devel@gnu.org; Thu, 13 Dec 2012 22:22:28 -0500 Original-Received: from mailout-de.gmx.net ([10.1.76.32]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MKffd-1TkB4H1OmF-001xM8 for ; Fri, 14 Dec 2012 04:22:26 +0100 Original-Received: (qmail invoked by alias); 14 Dec 2012 03:22:26 -0000 Original-Received: from 91-119-183-136.dynamic.xdsl-line.inode.at (EHLO cubox.home.rotty.xx.vu) [91.119.183.136] by mail.gmx.net (mp032) with SMTP; 14 Dec 2012 04:22:26 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX18Vc9pceccVd41oGdvS6WSEb5coy7FM+ymg6DQlej Al7LitJJyekabj Original-Received: from delenn.home.rotty.xx.vu (delenn.home.rotty.xx.vu [IPv6:fdfb:599d:f328:2::6e]) by cubox.home.rotty.xx.vu (Postfix) with ESMTP id 57A4116009E; Fri, 14 Dec 2012 04:22:24 +0100 (CET) Original-Received: by delenn.home.rotty.xx.vu (Postfix, from userid 1000) id 1E24B320160; Fri, 14 Dec 2012 04:22:24 +0100 (CET) In-Reply-To: <874njq96iw.fsf@tines.lan> (Mark H. Weaver's message of "Wed, 12 Dec 2012 18:48:07 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.18 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:15346 Archived-At: Mark H Weaver writes: > Hi Andreas, > > Andreas Rottmann writes: >> Mark H Weaver writes: >>> Andreas Rottmann writes: >>>> This patch series addresses the problem that `get-datum' is using the >>>> global reader options, even for those options that have to have fixed >>>> values to make the reader behave in an R6RS-compatible way. >>> >>> I'm sorry to have not done so earlier, but I finally looked at the R6RS >>> specification for 'get-datum', and I don't see anything to suggest that >>> it should recognize a different notation than 'read' does. >>> >> I think it does. But in the place where one would expect, namely the >> docs on `get-datum' (8.2.6), it does not say it as clearly as one would >> like: >> >> Reads an external representation from textual-input-port and returns >> the datum it represents. The get-datum procedure returns the next >> datum that can be parsed from the given textual-input-port, updating >> textual-input-port to point exactly past the end of the external >> representation of the object. > > Section 8.3 defines 'read' as follows: > > Reads an external representation from textual-input-port and returns > the datum it represents. The read procedure operates in the same way > as get-datum, see section 8.2.9. > > I believe this last sentence clearly confirms my belief that 'read' and > 'get-datum' should recognize the same syntax. > Well yes, R6RS `read' and R6RS `get-datum' need to understand the same syntax, but I thought you were talking about Guile `read' and R6RS `get-datum'. >> >>> Maybe what we should have instead is a command-line option that sets >>> some(?) of the global read options to conform with R6RS. >>> >>> What do you think? >>> >> I disagree quite strongly -- IMO, `get-datum' must, for every valid >> datum, according to R6RS lexical syntax, return the Scheme data denoted >> by that external representation. By that rule, one must fix the values >> of reader options which would otherwise lead to valid R6RS external >> representations being read as a datum different from the one which would >> result according to R6RS syntax. > > I agree that there should be an easy way to set the reader options so > that all of the R6RS external representations are read as specified. > Yes, but this cannot be a program-global switch -- it is simply defined behavior `get-datum', which must *not* be affected by any global switches. An R6RS syntax commandline switch would make sense regardless, for dealing with e.g. script syntax, but this is a completely orthogonal issue, and I'd like to concentrate on the `get-datum' correctness issue for now. > IMO, this needs to be done not only for 'get-datum' but also for 'read', > hence my suggestion to provide some way to set the global read options > appropriately. > Yup, R6RS `read' needs to be implemented in terms of `get-datum', not only because of reader options, but also because of the required exception behavior. This is how it's done already -- see modules/rnrs/io/simple.scm. > On the flip side, if someone has enabled SRFI-105 curly-infix > expressions, or any other reader extension that does not conflict with > standard R6RS notation, then both 'get-datum' and 'read' should honor > that setting. > > Does that make sense? > It does, and I think this is also what my patch implements, if I understood both the code and your words correctly :-). Regards, Rotty -- Andreas Rottmann --