Those look like good ones. I am a little annoyed at times by INTERN too, for instance, it is annoying that you cant just re-intern symbols, you have to get symbol-name all the time. Same for the package, you can't just refer to it with a string/symbol, you have to get the actual package. CL sometimes seems to have the idea a little to use functions as a tool for the user to define the types(for instance ELT for sequences(more general), NTH for lists, AREF for arrays), don't think that is the best approach, or that CL applies it consistently. (For instance, string-downcase works on symbols)
To try get intern to work for me better i guess i am going to try
- Code: Select all
(defun intern* (name &optional (package *package*))
"More flexible interning."
(typecase name
(string
(intern name (typecase package
(package package)
((or symbol string) (find-package package)))))
(symbol
(intern* (symbol-name name) package))))
There are valid uses, but also some abuses of altering symbols. For instance changing symbols and defining functions with those names is bad practice; people might collide with those. Better to use a hash table with functions, or methods with first argument EQL to something, or (even)a separate package, though that seems a little crazy.
The error macro looks good too, ah apparently you enter a symbol into the first argument of
ERROR to call the error by that name. Feel silly i didn't even know that..