[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memoization of `case' and `else'

From: Ludovic Courtès
Subject: Memoization of `case' and `else'
Date: Sun, 08 Apr 2007 23:49:19 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)


The "case is hygienic" test case in `syntax.test' looks suspicious to
me.  Why would the fact that `else' is bound influence the syntax of

For `cond', whether `else' and `=>' are bound does have an impact,
though.  Perhaps those bits were copied from `cond'?

The relevant changes date back to 2003-10-11.


--- orig/libguile/eval.c
+++ mod/libguile/eval.c
@@ -962,9 +962,6 @@
   SCM clauses;
   SCM all_labels = SCM_EOL;
-  /* Check, whether 'else is a literal, i. e. not bound to a value. */
-  const int else_literal_p = literal_p (scm_sym_else, env);
   const SCM cdr_expr = SCM_CDR (expr);
   ASSERT_SYNTAX (scm_ilength (cdr_expr) >= 0, s_bad_expression, expr);
   ASSERT_SYNTAX (scm_ilength (cdr_expr) >= 2, s_missing_clauses, expr);
@@ -994,7 +991,7 @@
-          ASSERT_SYNTAX_2 (scm_is_eq (labels, scm_sym_else) && else_literal_p,
+          ASSERT_SYNTAX_2 (scm_is_eq (labels, scm_sym_else),
                            s_bad_case_labels, labels, expr);
           ASSERT_SYNTAX_2 (scm_is_null (SCM_CDR (clauses)),
                            s_misplaced_else_clause, clause, expr);

--- orig/test-suite/tests/syntax.test
+++ mod/test-suite/tests/syntax.test
@@ -636,13 +636,6 @@
   (pass-if "clause with empty labels list"
     (case 1 (() #f) (else #t)))
-  (with-test-prefix "case is hygienic"
-    (pass-if-exception "bound 'else is handled correctly"
-      exception:bad-case-labels
-      (eval '(let ((else #f)) (case 1 (else #f)))
-            (interaction-environment))))
   (with-test-prefix "unmemoization"
     (pass-if "normal clauses"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]