[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] variable datums with syncase transformer
From: |
Neil Jerram |
Subject: |
Re: [patch] variable datums with syncase transformer |
Date: |
Thu, 06 Mar 2008 23:28:57 +0000 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi Stephen,
Following Ludovic's request for me to review this...
Stephen Compall <address@hidden> 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