> Sometimes when I am developing a library, I change, for example, function names.
> But if another function is still calling the old function name, it still compiles correctly, but calls the wrong function.
If you use defpackage, SBCL (for example) will warn you about such case.
You can handle that warning and unintern symbol.
I.e. make a macro which would wrap defpackage in handler-bind to catch
warning sent by SBCL and unintern symbol. Since it is only revelant
during development it doesn't need to be portable.
Alternatively, you can implement wrapper for defpackage which does this
without support from implementation. This is probably easier than you
think (about as complex as your uninterner function), check defpackage
code in SBCL for example.
E.g. function update-package-with-variance receives a list of exports.
But it gathers a list of old exports first:
(do-external-symbols (symbol package)
(push symbol old-exports))
Then it computes difference:
(setf old-exports (set-difference old-exports exports :test #'string=))
And warns if there is something in that difference,
> I would typically restart slime/lisp, but never liked that solution. I thought this would be a cleaner way:
> - go to cl-user
> - clean-up the package
> - reload the library
No, cleaner way is to restart. Nuking package is a lazier way.
It won't help when you define methods for GFs in other package, for example.
Clean environment is a clean environment.