Commits

Leslie P. Polzer  committed 2b2c158

support serialization of uninterned symbols

  • Participants
  • Parent commits dfeb8fc

Comments (0)

Files changed (3)

File src/serialization/sexp.lisp

 	(name (prin1-to-string symbol)))
     (cond ((eq package +cl-package+) (write-string "CL:" stream))
 	  ((eq package +keyword-package+) (write-char #\: stream))
-	  (t (s-xml:print-string-xml (package-name package) stream)
-	     (write-string "::" stream)))
+	  (package (s-xml:print-string-xml (package-name package) stream)
+                   (write-string "::" stream))
+          (t (write-string "#:" stream)))
     (if (char= (char name (1- (length name))) #\|)
         (write-string name stream :start (position #\| name))
       (write-string name stream :start (1+ (or (position #\: name :from-end t) -1))))))

File src/serialization/xml.lisp

 	(name (prin1-to-string symbol)))
     (cond ((eq package +cl-package+) (write-string "CL:" stream))
 	  ((eq package +keyword-package+) (write-char #\: stream))
-	  (t (s-xml:print-string-xml (package-name package) stream)
-	     (write-string "::" stream)))
+	  (package (s-xml:print-string-xml (package-name package) stream)
+	     (write-string "::" stream))
+          (t (write-string "#:" stream)))
     (if (char= (char name (1- (length name))) #\|)
         (s-xml:print-string-xml name stream :start (position #\| name))
       (s-xml:print-string-xml name stream :start (1+ (or (position #\: name :from-end t) -1))))))

File test/test-serialization.lisp

    (eq (serialize-and-deserialize-sexp '|Unprintable|)
        '|Unprintable|)))
 
+(test test-uninterned-symbol-sexp
+  (let ((sym (gensym)))
+    (is (equal (princ-to-string (serialize-and-deserialize-sexp sym))
+               (princ-to-string sym)))))
+
+(test test-uninterned-symbol-xml
+  (let ((sym (gensym)))
+    (is (equal (princ-to-string (serialize-and-deserialize-xml sym))
+               (princ-to-string sym)))))
+
 (test test-primitive-21
   (is
    (equal (serialize-and-deserialize-xml "Hello")