Eliminate potentially-problematic use of delay for char-set-predicate.
authorChris Hanson <org/chris-hanson/cph>
Sun, 10 Feb 2019 22:04:07 +0000 (14:04 -0800)
committerChris Hanson <org/chris-hanson/cph>
Sat, 16 Mar 2019 05:44:26 +0000 (22:44 -0700)
src/runtime/char-set.scm

index 10398e25b532808cc5b4a8a2319266338eb86446..335fa98d5548e3caf07748e58e014d8afe8fab59 100644 (file)
@@ -43,22 +43,18 @@ USA.
     char-set?
   (low %char-set-low)
   (high %char-set-high)
-  (predicate %char-set-predicate)
+  (predicate char-set-predicate)
   ;; backwards compatibility for Edwin:
   (table %char-set-table))
 
 (define (make-char-set low high)
-  (letrec
-      ((char-set
-       (%make-char-set low high
-         (delay
-           (let ((predicate
-                  (lambda (char)
-                    (and (bitless-char? char)
-                         (char-in-set? char char-set)))))
-             (register-predicate! predicate 'char-set-predicate
-                                   '<= bitless-char?)
-             predicate))
+  (letrec*
+      ((predicate
+       (lambda (char)
+         (and (bitless-char? char)
+              (char-in-set? char char-set))))
+       (char-set
+       (%make-char-set low high predicate
          (delay
            (let ((table (make-bytevector #x100)))
              (do ((cp 0 (fix:+ cp 1)))
@@ -68,6 +64,7 @@ USA.
                                        1
                                        0)))
              table)))))
+    (register-predicate! predicate 'char-set-predicate '<= bitless-char?)
     char-set))
 
 (define-integrable %low-cps-per-byte 8)
@@ -448,9 +445,6 @@ USA.
                      (else #t)))
              #f)))))
 
-(define (char-set-predicate char-set)
-  (force (%char-set-predicate char-set)))
-
 (define (char-set-table char-set)
   (force (%char-set-table char-set)))