From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Per-module reader, take #2 Date: Sun, 30 Oct 2005 19:55:19 +0000 Message-ID: <87ll0a3hlk.fsf@ossau.uklinux.net> References: <87u0gp9lm3.fsf@laas.fr> <877jd3lkdq.fsf@ossau.uklinux.net> <87hdc62a6c.fsf@laas.fr> <87irw49twc.fsf@laas.fr> <87irw3prgp.fsf@ossau.uklinux.net> <8764rw7b9q.fsf_-_@laas.fr> <871x2j98qb.fsf@ossau.uklinux.net> <87u0ffnudk.fsf@laas.fr> <87sluxb0xt.fsf@ossau.uklinux.net> <87r7agvdb1.fsf@laas.fr> <87wtk796xk.fsf@ossau.uklinux.net> <87br1jiacq.fsf@laas.fr> <87d5lp9vv4.fsf@ossau.uklinux.net> <871x258dxd.fsf@zip.com.au> <87zmos8zt4.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 1130702320 11932 80.91.229.2 (30 Oct 2005 19:58:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 Oct 2005 19:58:40 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Oct 30 20:58:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EWJIz-0005OK-1v for guile-devel@m.gmane.org; Sun, 30 Oct 2005 20:57:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWJIy-0002BT-7E for guile-devel@m.gmane.org; Sun, 30 Oct 2005 14:57:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWJIv-0002A1-9W for guile-devel@gnu.org; Sun, 30 Oct 2005 14:57:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWJIt-00028E-Px for guile-devel@gnu.org; Sun, 30 Oct 2005 14:57:21 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWJIt-000281-MR for guile-devel@gnu.org; Sun, 30 Oct 2005 14:57:19 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWJIt-0004CE-RI for guile-devel@gnu.org; Sun, 30 Oct 2005 14:57:20 -0500 Original-Received: from laruns (host81-130-88-151.in-addr.btopenworld.com [81.130.88.151]) by mail3.uklinux.net (Postfix) with ESMTP id 271F5409FD7 for ; Sun, 30 Oct 2005 19:55:27 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 5EECB6F6CE for ; Sun, 30 Oct 2005 19:55:19 +0000 (GMT) Original-To: guile-devel@gnu.org In-Reply-To: <87zmos8zt4.fsf@ossau.uklinux.net> (Neil Jerram's message of "Sat, 29 Oct 2005 09:58:31 +0100") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) 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:5367 Archived-At: Neil Jerram writes: > Another detail that needs thought is whether any of the stack of load > procedures defined in r4rs.scm and boot-9.scm (load-from-path, load > and load-module) need enhancing to take a reader arg. The stack of load procedures is... primitive-load, defined in load.c `load' defined in r4rs.scm, which boot-9.scm then renames as `basic-load'. This is presumably intended to be an R4RS-compliant load; its implementation builds on primitive-load by setting a hook which can announce the file being loaded, and by starting a new stack (start-stack). `load-module' defined in boot-9.scm. This builds on basic-load by adding - save-module-excursion, so that loading a module doesn't change the loader's current module - the ability to load files with relative path names. Finally boot-9 does (define load load-module), so `load' ends up being what I just described as load-module. So one possibility for adding custom reader support to all this is... - Don't put any current-reader framing code in primitive-load. In other words, don't reset current-reader to #f (or anything else) at the start of primitive-load, and don't use framing to restore the value of the current-reader at the end if the loaded code has changed it. This means that primitive-load keeps its existing primitiveness - i.e. it isn't much more than just a read eval loop. - Add an optional reader arg to both r4rs's load and boot-9's load-module, and treat as #f if not specified. In r4rs load, do (with-fluids ((the-reader reader)) ...) around the existing code. In load-module, just pass the reader through to basic-load. This would preserve existing behaviour for any calls to load or use-modules, which are the mainline cases, even when the caller has installed a non-default reader, but it also allows developers to achieve different behaviour when they want it by using primitive-load and the optional reader arg to load. This can also be seen as analogous to how primitive-eval allows (current-module) to change, but eval doesn't. Regards, Neil _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel