From 2c3bd2b04a2b4fff600cd6c430244a8b543ddbd8 Mon Sep 17 00:00:00 2001 From: LemonBoy
Date: Thu, 28 Apr 2016 11:11:46 +0200 Subject: [PATCH] Change how unbound variables are checked for. To: address@hidden The previous method checks if the object 'x' we want to check is equal to the value contained in the first slot of a symbol that's supposed to always be undefined. This patch replaces the code above with the use of the C_boundp and C_unboundvaluep macros with no functional effect. --- csi.scm | 2 +- eval.scm | 6 +----- extras.scm | 2 +- library.scm | 5 ++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/csi.scm b/csi.scm index 5466deb..65ec3fe 100644 --- a/csi.scm +++ b/csi.scm @@ -621,7 +621,7 @@ EOF ((bignum? x) (fprintf out "exact large integer ~S~% #x~X~% #o~O~% #b~B~%" x x x x) ) - ((eq? x (##sys#slot '##sys#arbitrary-unbound-symbol 0)) + ((##core#inline "C_unboundvaluep" x) (fprintf out "unbound value~%") ) ((flonum? x) (fprintf out "inexact rational number ~S~%" x)) ((ratnum? x) (fprintf out "exact ratio ~S~%" x)) diff --git a/eval.scm b/eval.scm index b426d11..c4755c5 100644 --- a/eval.scm +++ b/eval.scm @@ -206,11 +206,7 @@ (define ##sys#eval-debug-level (make-parameter 1)) (define compile-to-closure - (let ([write write] - [reverse reverse] - [with-input-from-file with-input-from-file] - [unbound (##sys#slot '##sys#arbitrary-unbound-symbol 0)] - [display display] ) + (let ((reverse reverse)) (lambda (exp env se #!optional cntr evalenv static) (define (find-id id se) ; ignores macro bindings diff --git a/extras.scm b/extras.scm index 6f0455c..c04f9ef 100644 --- a/extras.scm +++ b/extras.scm @@ -359,7 +359,7 @@ [else (out (make-string 1 obj) col)] ) ) ) ) ((##core#inline "C_undefinedp" obj) (out "#