Add a namespace slot to deprecation information
[sbcl.git] / src / cold / rename-package-carefully.lisp
blob797571b5d171b9840fae7e00997d736131c248d1
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB-COLD")
12 ;;; RENAME-PACKAGE in two steps in order to avoid the possibility of undefined
13 ;;; behavior when one of the new names is the same as one of the old names.
14 ;;; (ANSI on RENAME-PACKAGE: "The consequences are undefined if new-name or any
15 ;;; new-nickname conflicts with any existing package names.")
16 (defun rename-package-carefully (package-designator
17 new-name
18 &optional new-nicknames)
19 (let ((package (find-package package-designator))
20 (unused-name "UNUSED-PACKAGE-NAME"))
21 (assert (not (find-package unused-name)))
22 (assert (not (string= unused-name new-name)))
23 (assert (not (find unused-name new-nicknames :test #'string=)))
24 (assert (not (find new-name new-nicknames :test #'string=)))
25 (rename-package package unused-name)
26 (rename-package package new-name new-nicknames)))
27 (compile 'rename-package-carefully)