bug#36430: Write should escape symbols that look special.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Tue, 8 May 2012 18:41:27 +0000 (11:41 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Tue, 8 May 2012 18:41:27 +0000 (11:41 -0700)
(write '|#f|) now emits "|#f|", not "#f".

src/runtime/unpars.scm

index adeaaf997977592b73981cb4b2575e7273b5563b..bde57101ad1a85291fc1bdb07ecfabd25bd46e18 100644 (file)
@@ -367,7 +367,8 @@ USA.
          (and (char-set-member? char-set/number-leaders (string-ref s 0))
               (string->number s))
          (and (fix:> (string-length s) 1)
-              (looks-like-keyword? s)))
+              (or (looks-special? s)
+                  (looks-like-keyword? s))))
       (begin
        (*unparse-char #\|)
        (let ((end (string-length s)))
@@ -387,6 +388,9 @@ USA.
        (*unparse-char #\|))
       (*unparse-string s)))
 
+(define (looks-special? string)
+  (char=? (string-ref string 0) #\#))
+
 (define (looks-like-keyword? string)
   (case (environment-lookup *environment* '*PARSER-KEYWORD-STYLE*)
     ((PREFIX)