From: LemonBoy <thatle...@gmail.com>

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.

Signed-off-by: Evan Hanson <ev...@foldling.org>
---
 csi.scm     | 4 ++--
 eval.scm    | 6 +-----
 extras.scm  | 2 +-
 library.scm | 5 ++---
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/csi.scm b/csi.scm
index 5466deb..9eabeb6 100644
--- a/csi.scm
+++ b/csi.scm
@@ -621,8 +621,8 @@ 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))
-            (fprintf out "unbound value~%") )
+           ((##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))
            ((cplxnum? x) (fprintf out "~A complex number ~S~%"
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 "#<unspecified>" col))
            ((##core#inline "C_anypointerp" obj) (out (##sys#pointer->string 
obj) col))
-           ((eq? obj (##sys#slot '##sys#arbitrary-unbound-symbol 0))
+           ((##core#inline "C_unboundvaluep" obj)
             (out "#<unbound value>" col) )
            ((##sys#generic-structure? obj)
             (let ([o (open-output-string)])
diff --git a/library.scm b/library.scm
index e0b3004..292554e 100644
--- a/library.scm
+++ b/library.scm
@@ -3978,8 +3978,7 @@ EOF
                                [else (outchr port x)] ) ) ] 
                       [else (outchr port x)] ) )
                ((##core#inline "C_fixnump" x) (outstr port 
(##sys#number->string x)))
-               ((eq? x (##sys#slot '##sys#arbitrary-unbound-symbol 0))
-                (outstr port "#<unbound value>") )
+               ((##core#inline "C_unboundvaluep" x) (outstr port "#<unbound 
value>"))
                ((not (##core#inline "C_blockp" x)) (outstr port "#<invalid 
immediate object>"))
                ((##core#inline "C_forwardedp" x) (outstr port "#<invalid 
forwarded object>"))
                ((##core#inline "C_symbolp" x)
@@ -5034,7 +5033,7 @@ EOF
   (##core#inline "C_update_pointer" addr vec) )
 
 (define (##sys#symbol-has-toplevel-binding? s)
-  (not (eq? (##sys#slot s 0) (##sys#slot '##sys#arbitrary-unbound-symbol 0))) )
+  (##core#inline "C_boundp" s))
 
 (define (##sys#copy-bytes from to offset1 offset2 bytes)
   (##core#inline 
-- 
2.7.0


_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to