From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Per-module reader Date: Wed, 12 Oct 2005 11:11:35 +0200 Organization: LAAS-CNRS Message-ID: <87vf03rtfc.fsf@laas.fr> References: <87u0gp9lm3.fsf@laas.fr> <877jd3lkdq.fsf@ossau.uklinux.net> <87hdc62a6c.fsf@laas.fr> <87irw49twc.fsf@laas.fr> <87irw3prgp.fsf@ossau.uklinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129110864 4677 80.91.229.2 (12 Oct 2005 09:54:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Oct 2005 09:54:24 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Oct 12 11:54:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EPdIS-0001A2-Gl for guile-devel@m.gmane.org; Wed, 12 Oct 2005 11:53:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPdIR-00088C-Tu for guile-devel@m.gmane.org; Wed, 12 Oct 2005 05:53:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EPclE-00068x-Ny for guile-devel@gnu.org; Wed, 12 Oct 2005 05:18:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EPclA-00068Q-7x for guile-devel@gnu.org; Wed, 12 Oct 2005 05:18:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPcgx-0005ro-3q for guile-devel@gnu.org; Wed, 12 Oct 2005 05:14:32 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EPcgw-0000BP-JA for guile-devel@gnu.org; Wed, 12 Oct 2005 05:14:30 -0400 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id j9C9ESRm007024; Wed, 12 Oct 2005 11:14:29 +0200 (CEST) Original-To: Neil Jerram X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 21 =?iso-8859-1?Q?Vend=E9miaire?= an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Neil Jerram , guile-devel@gnu.org In-Reply-To: <87irw3prgp.fsf@ossau.uklinux.net> (Neil Jerram's message of "Wed, 12 Oct 2005 00:24:38 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5270 Archived-At: Neil Jerram writes: > If I'm understanding correctly, your argument rests on wanting to > allow people to write a module like this: > > (define-module (shell utils) > #:reader shell-reader > #:use-module (shell reader) > #:export (for)) > > for () { > beg=$1 > end=$2 > ... > } > > rather than like this (with the shell code in another file): > > (define-module (shell utils) > #:use-module (shell reader) > #:export (for)) > > (load-using-reader "for.sh" shell-reader) That could be one possibility. The other issue is providing a basic mechanism to help fixing the current single-instance `read' issue. Again, there's only one instance of `read', and `read-enable', `read-hash-extend' and the likes modify that very single instance. This means that they have side-effects /across/ modules. This also means that it may turn out that two modules cannot be used together because they rely on incompatible reader settings. Maybe you do not consider this to be an issue in practice, but at least, I think we'd agree that this approach is flawed. Assuming that this /is/ an issue in practice, I can think of only two ways to fix this: 1. Remove all the `read' configuration tricks; 2. Allow for per-module readers. Obviously, (1) is not acceptable to me, and I guess, for most people. Part of (2) also means being able to instantiate and tweak readers, which is what `guile-reader' is about. > I admit that in the future something like this _could_ be a key part > of Guile's support for translators, but right now we don't have enough > translation experience to say that this will end up being the right > thing, and on its own merits the benefit of being able to write > foreign code with a Guile module header in the same file seems very > marginal to me. I was not thinking about such extreme uses of the system. And honestly, I doubt Guile will ever be able to run foreign code. It might have been able to achieve this in its glory days back in 1999-2000, but I don't think it should be a goal now. This is sad, especially since you apparently did a great job with Elisp translation. > And to get this marginal benefit we have to add a module option and > some code which will slow down normal operation. Not noticeably > perhaps, but it all adds up. Not noticeably, indeed. And modules are read only once. And Guile is an interpreter anyway. ;-) However, in my previous post, I noted: The two main sources of inefficiency are (i) the use of `scm_call' instead of a direct call to the reader subr, and (ii) the successive calls to `scm_current_module ()'. In the simple case, (i) can be avoided by having modules' reader default to `#f' as you noted earlier. As for (ii), we would greatly benefit from having an inlined version of `scm_current_module ()'. Both optimizations seem feasible. > Finally, wouldn't you be making more headache for yourself (in the > medium term) by relying on #:reader in the core rather than something > like load-using-reader in your library? With #:reader in the core, > your package code would only work with Guile CVS and >=1.7 releases > after a certain date, whereas with load-using-reader your code will > work with 1.6, 1.7/1.8 and probably 1.4 as well. Of course I can do without it. The point is that I considered this to be an elegant solution to allow coexistence within a program of different syntax *variants* (personally, I don't care about writing Guile modules in Python or Sh, etc.). Thanks, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel