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] variable datums with syncase transformer Date: Thu, 06 Mar 2008 23:28:57 +0000 Message-ID: <87hcfjph3a.fsf@ossau.uklinux.net> References: <1197619616.5218.34.camel@nocandy.dyndns.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204846161 19815 80.91.229.12 (6 Mar 2008 23:29:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Mar 2008 23:29:21 +0000 (UTC) Cc: Ludovic =?iso-8859-1?Q?Court=E8s?= , guile-devel@gnu.org To: Stephen Compall Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 07 00:29:47 2008 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 1JXPX1-0001Cg-A7 for guile-devel@m.gmane.org; Fri, 07 Mar 2008 00:29:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JXPWT-0002Ua-A1 for guile-devel@m.gmane.org; Thu, 06 Mar 2008 18:29:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JXPWQ-0002U4-07 for guile-devel@gnu.org; Thu, 06 Mar 2008 18:29:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JXPWO-0002Tj-CU for guile-devel@gnu.org; Thu, 06 Mar 2008 18:29:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JXPWO-0002Tc-60 for guile-devel@gnu.org; Thu, 06 Mar 2008 18:29:08 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JXPWK-0003bH-2u; Thu, 06 Mar 2008 18:29:04 -0500 Original-Received: from arudy (host86-145-183-175.range86-145.btcentralplus.com [86.145.183.175]) by mail3.uklinux.net (Postfix) with ESMTP id 9263E1F6A25; Thu, 6 Mar 2008 23:28:59 +0000 (GMT) Original-Received: from laruns (laruns [192.168.0.10]) by arudy (Postfix) with ESMTP id C54473800A; Thu, 6 Mar 2008 23:28:57 +0000 (GMT) In-Reply-To: <1197619616.5218.34.camel@nocandy.dyndns.org> (Stephen Compall's message of "Fri, 14 Dec 2007 02:06:56 -0600") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: 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:7065 Archived-At: Hi Stephen, Following Ludovic's request for me to review this... Stephen Compall writes: > +;; The question syncase is asking when it asks `self-evaluating?' is > +;; not really whether a given datum is self-evaluating, but whether it > +;; should pass the datum through as-is to the evaluator. With that in > +;; mind, we wrap core `self-evaluating?' here so that syncase will > +;; pass-through variables, meaning (variable? datum) => #t, to the > +;; evaluator. Without this, the system transformer will see a > +;; variable datum as invalid syntax, which it is not to the core > +;; transformer. > +(define (self-evaluating? datum) > + (or ((@ (guile) self-evaluating?) datum) > + (variable? datum))) > + Given that self-evaluating? has no other purpose, I think it would be preferable just to add "case scm_tc7_variable:" to the C code, along with your excellent comment above. I know that would technically be an incompatible change, but given that I never heard mention of self-evaluating? before, I think we can risk it. (And someone can always write (define (compatible-self-evaluating? obj) (and (self-evaluating? obj) (not (variable? obj)))) if they need to.) > ;;; Load the preprocessed code > > (let ((old-debug #f) > Index: test-suite/tests/syncase.test > =================================================================== > RCS file: /sources/guile/guile/guile-core/test-suite/tests/syncase.test,v > retrieving revision 1.5 > diff -u -d -u -r1.5 syncase.test > --- test-suite/tests/syncase.test 16 Apr 2006 23:27:14 -0000 1.5 > +++ test-suite/tests/syncase.test 14 Dec 2007 07:55:49 -0000 > @@ -34,3 +34,15 @@ > > (pass-if "basic syncase macro" > (= (plus 1 2 3) (+ 1 2 3))) > + > +(pass-if "variable?s recognized as datums" > + (false-if-exception > + (begin (eq? car (eval '(@ (guile) car) (current-module))) > + #t))) > + > +(define-syntax export-safe-plus > + (syntax-rules () > + ((_ x ...) ((@ (guile) +) x ...)))) > + > +(pass-if "variable?s passed through to evaluator" > + (= (export-safe-plus 1 2 3) (+ 1 2 3))) These tests are fine (of course!). Regards, Neil