Am 17.11.2013 00:59, schrieb David A. Wheeler:
On 16 Nov 2013 22:16:27 +0100, Jörg F. Wittenberger 
<joerg.wittenber...@softeyes.net> wrote:
As to wish lists: at the moment I have no need use for `set-read-mode`.
Once I'm there I'll want this thread-safe. I'd turn toplevel variables it
modifies into parameter objects. If there are no objections.
I like thread-safe, but that would change the interface significantly, yes?


Depends on your notion of significance.  Attached a patch.
--- kernel.scm.orig	2013-11-17 14:29:29.000000000 +0100
+++ kernel.scm	2013-11-17 14:38:13.000000000 +0100
@@ -544,7 +544,7 @@
   ; so let's start with #f (case-sensitive).
   ; This doesn't affect character names; as an extension,
   ; We always accept arbitrary case for them, e.g., #\newline or #\NEWLINE.
-  (define is-foldcase #f)
+  (define is-foldcase (make-parameter #f))
 
   ; special tag to denote comment return from hash-processing
 
@@ -579,10 +579,10 @@
   (define whitespace-chars whitespace-chars-ascii)
 
   ; If #t, handle some constructs so we can read and print as Common Lisp.
-  (define common-lisp #f)
+  (define common-lisp (make-parameter #f))
 
   ; If #t, return |...| symbols as-is, including the vertical bars.
-  (define literal-barred-symbol #f)
+  (define literal-barred-symbol (make-parameter #f))
 
   ; Returns a true value (not necessarily #t)
   (define (char-line-ending? char) (memv char line-ending-chars))
@@ -705,13 +705,13 @@
     ; TODO: Should be per-port
     (cond
       ((eq? mode 'common-lisp)
-        (set! common-lisp #t) #t)
+        (common-lisp #t) #t)
       ((eq? mode 'literal-barred-symbol)
-        (set! literal-barred-symbol #t) #t)
+        (literal-barred-symbol #t) #t)
       ((eq? mode 'fold-case)
-        (set! is-foldcase #t) #t)
+        (is-foldcase #t) #t)
       ((eq? mode 'no-fold-case)
-        (set! is-foldcase #f) #t)
+        (is-foldcase #f) #t)
       (else (display "Warning: Unknown mode") #f)))
 
 ; -----------------------------------------------------------------------------
@@ -872,7 +872,7 @@
   ; is-foldcase configuration value when processing symbols.
   ; TODO: Should be port-specific
   (define (fold-case-maybe port s)
-    (if is-foldcase
+    (if (is-foldcase)
         (my-string-foldcase s)
         s))
 
@@ -886,9 +886,9 @@
       ((string-ci=? dir "curly-infix")
         (replace-read curly-infix-read))
       ((string-ci=? dir "fold-case")
-        (set! is-foldcase #t))
+        (is-foldcase #t))
       ((string-ci=? dir "no-fold-case")
-        (set! is-foldcase #f))
+        (is-foldcase #f))
       (else (display "Warning: Unknown process directive"))))
 
   ; Consume characters until "!#"
@@ -1003,7 +1003,7 @@
         (else ; Try out different readers until we find a match.
           (my-read-char port)
           (or
-            (and common-lisp
+            (and (common-lisp)
                  (parse-cl no-indent-read c port))
             (parse-hash no-indent-read c port)
             (parse-default no-indent-read c port)
@@ -1111,7 +1111,7 @@
   ; Translate "x" to Common Lisp representation if we're printing CL.
   ; Basically we use a very unusual representation, and then translate it back
   (define (translate-cl x)
-    (if common-lisp
+    (if (common-lisp)
       (case x
         ((quasiquote)       '+++CL-QUASIQUOTE-abbreviation+++)
         ((unquote)          '+++CL-UNQUOTE-abbreviation+++)
@@ -1228,7 +1228,7 @@
   (define (get-barred-symbol port)
     (my-read-char port) ; Consume the initial vertical bar.
     (string->symbol (list->string
-      (if literal-barred-symbol
+      (if (literal-barred-symbol)
         (cons #\| (read-literal-symbol port))
         (read-symbol-elements port)))))
 
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to