I have defined a package: (defpackage my-package (:use cl) (:export my-function)). When using in-package for that package, what should be the type of the argument given to in-package?
The Common Lisp HyperSpec says:
in-package name => package
Arguments and Values:
name---a string designator; not evaluated.
package---the package named by name.
I have tried the following:
(in-package my-package)— ✓(in-package :my-package)— ✓(in-package #:my-package)— ✓(in-package "MY-PACKAGE")— ✓
All of the above appear to be valid. What is the difference between the above? Which of the above should I use?
In addition, I noticed this:
(in-package 'my-package)— ✗Error in SBCL:
; compiling file "/path/to/my-program.lisp" (written 12 MAR 2021 01:23:45 AM): ; compiling (IN-PACKAGE (QUOTE MY-PACKAGE)) ; file: /path/to/my-program.lisp ; in: IN-PACKAGE 'MY-PACKAGE ; (IN-PACKAGE 'MY-PACKAGE) ; ; caught ERROR: ; (during macroexpansion of (IN-PACKAGE 'MY-PACKAGE)) ; 'MY-PACKAGE is not a string designator
Why is it correct to use a keyword or uninterned symbol, but not a symbol?