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: Should psyntax pass through a compiled VM program? Date: Sun, 13 Sep 2009 22:17:34 +0100 Message-ID: <87iqfm7de9.fsf@arudy.ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252876676 27060 80.91.229.12 (13 Sep 2009 21:17:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Sep 2009 21:17:56 +0000 (UTC) To: Guile Development Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Sep 13 23:17:49 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MmwSD-0006m5-Dx for guile-devel@m.gmane.org; Sun, 13 Sep 2009 23:17:49 +0200 Original-Received: from localhost ([127.0.0.1]:35663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmwSC-0000BF-S0 for guile-devel@m.gmane.org; Sun, 13 Sep 2009 17:17:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MmwS5-00008r-Ig for guile-devel@gnu.org; Sun, 13 Sep 2009 17:17:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MmwS0-0008R7-TJ for guile-devel@gnu.org; Sun, 13 Sep 2009 17:17:41 -0400 Original-Received: from [199.232.76.173] (port=44787 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmwS0-0008Qw-NM for guile-devel@gnu.org; Sun, 13 Sep 2009 17:17:36 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:40894) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MmwS0-0003op-DZ for guile-devel@gnu.org; Sun, 13 Sep 2009 17:17:36 -0400 Original-Received: from arudy (host86-147-112-99.range86-147.btcentralplus.com [86.147.112.99]) by mail3.uklinux.net (Postfix) with ESMTP id 6489C1F66BB for ; Sun, 13 Sep 2009 22:17:35 +0100 (BST) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 0AFD138021 for ; Sun, 13 Sep 2009 22:17:35 +0100 (BST) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:9313 Archived-At: I think that's the right eventual question, anyway. The context is running Alan Grover's mod_lisp-for-guile in 1.9.2. The mod_lisp-for-guile code includes a use of read-hash-extend to define a syntax for a compiled regular expression - so that you can write things like (if (#m/^Error: +/ line) ...) with a similar effect to Perl if (line ~= /^Error: +/) ... So: (read-hash-extend #\m (lambda (c port) ... (lambda (string) ...))) In other words, the custom reader procedure returns another procedure. So the read code (for the above example) becomes (if (# line) ...) In pre-VM Guile, (I assume) this worked because there wasn't a psyntax pass, and because the evaluator regards procedures as self-evaluating. But in VM Guile, the read code is (if (# line) ...) And psyntax errors when it hits the #. I've worked around this by rewriting the read-hash-extend code as (define-public (make-regexp-fn regexp-string) (lambda (string) ...)) (read-hash-extend #\m (lambda (c port) ... `(make-regexp-fn ,regexp-string))) but I wonder if there is a case for supporting the code as it was before, by - teaching psyntax to pass through a # if it sees one - making programs self-evaluating (and in fact they may already be so, I haven't checked). Also, is it definitely correct to call read-hash-extend procedures first, and do the psyntax pass later? I guess it must be, as we need to call the read-hash-extend procedure in order even to determine the extent of the relevant lexeme. Regards, Neil