1.0.5.8: always display package prefixes when symbols conflict
authorNathan Froyd <froydnj@cs.rice.edu>
Sun, 29 Apr 2007 18:34:20 +0000 (18:34 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Sun, 29 Apr 2007 18:34:20 +0000 (18:34 +0000)
* Patch by Kevin Reid, sbcl-devel 2007-04-28.

NEWS
src/code/target-package.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index f565ca5..ab3c173 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 ;;;; -*- coding: utf-8; -*-
 changes in sbcl-1.0.6 relative to sbcl-1.0.5:
+  * enhancement: when a symbol name conflict error arises, the
+    conflicting symbols are always printed with a package prefix.
+    (thanks to Kevin Reid)
   * bug fix: GETHASH, (SETF GETHASH), CLRHASH and REMHASH are now
     interrupt safe.
   * bug fix: GC race condition occasionally resulting in crashes with
index a8598ad..7a914d3 100644 (file)
@@ -786,6 +786,17 @@ error if any of PACKAGES is not a valid package designator."
                         string length hash ehash)
       (values symbol found))))
 \f
+(defun print-symbol-with-prefix (stream symbol colon at)
+  #!+sb-doc
+  "For use with ~/: Write SYMBOL to STREAM as if it is not accessible from
+  the current package."
+  (declare (ignore colon at))
+  ;; Only keywords should be accessible from the keyword package, and
+  ;; keywords are always printed with colons, so this guarantees that the
+  ;; symbol will not be printed without a prefix.
+  (let ((*package* *keyword-package*))
+    (write symbol :stream stream :escape t)))
+
 (define-condition name-conflict (reference-condition package-error)
   ((function :initarg :function :reader name-conflict-function)
    (datum :initarg :datum :reader name-conflict-datum)
@@ -794,7 +805,8 @@ error if any of PACKAGES is not a valid package designator."
   (:report
    (lambda (c s)
      (format s "~@<~S ~S causes name-conflicts in ~S between the ~
-                following symbols:~2I~@:_~{~S~^, ~}~:@>"
+                following symbols:~2I~@:_~
+                ~{~/sb-impl::print-symbol-with-prefix/~^, ~}~:@>"
              (name-conflict-function c)
              (name-conflict-datum c)
              (package-error-package c)
@@ -812,7 +824,9 @@ error if any of PACKAGES is not a valid package designator."
                (nlen (length (write-to-string len :base 10)))
                (*print-pretty* t))
           (format *query-io* "~&~@<Select a symbol to be made accessible in ~
-                              package ~A:~2I~@:_~{~{~V,' D. ~S~}~@:_~}~@:>"
+                              package ~A:~2I~@:_~{~{~V,' D. ~
+                              ~/sb-impl::print-symbol-with-prefix/~}~@:_~}~
+                              ~@:>"
                 (package-name package)
                 (loop for s in symbols
                       for i upfrom 1
index 6bff9a4..fabe34d 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.5.7"
+"1.0.5.8"