Commit 81c53f9e authored by Ambrevar's avatar Ambrevar

modern-common-lisp: Document package local nicknames.

parent 217343e9
#+TITLE: Modern, functional Common Lisp: Myths and tips
# TODO: Mention the macro-stepper and show a picture?
# TODO: Don't use =use=?
# https://old.reddit.com/r/lisp/comments/f98d1h/modern_functional_common_lisp_myths_and_best/
Common Lisp is a very powerful programming language, and yet it seems to only
enjoy a shy popularity. What is happening?
......@@ -292,6 +290,26 @@ prefer the safe way, stick to package imports.
packages, make sure you pin their exact version.
(Thanks to [[https://old.reddit.com/user/flaming_bird][flaming_bird]] for the [[https://old.reddit.com/r/lisp/comments/f98d1h/modern_functional_common_lisp_myths_and_best/fipyf7u/][detailed explanation]].)
** Local package nicknames
Since you should (almost always) =import= packages, you'll have to prefix their
symbols with the package name. Sometimes this package name can be lengthy to
write: in this case, you should know that you can assign a local nickname to any
package.
#+begin_src lisp
(defpackage my-package
(:use #:cl)
(:local-nicknames (#:a #:alexandria.dev.0)))
#+end_src
So now you can call the much shorter ~a:compose~ from your package!
See [[https://github.com/phoe/trivial-package-local-nicknames][package-local-nicknames]].
This approach is preferred over using the ~rename-package~ procedure which is
global.
** Recommended language-enhancing packages
The following packages are widespread and useful enough that can be =import=-ed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment