Barry Margolin
5/31/2016 1:07:00 AM
In article <20160530165019.530@kylheku.com>,
Kaz Kylheku <545-066-4921@kylheku.com> wrote:
> On 2016-05-30, Blake McBride <blake1024@gmail.com> wrote:
> > Hi,
> >
> > In terms of package name types that may be used in defpackage /
> > in-package / provide, I've seen strings, symbols, and keyword symbols.
> > Is there a best, and if so, why?
>
> Your list is not round without the mention of #:uninterned symbols
> which some Lisp programmers favor.
>
> I vote for keywords. Strings are noisy, due to quotes, and with the
> default read-tables of Common Lisp, "THEY SHOUT".
>
> Symbols require quoting when passed to functions and no quoting
> when passed to macros, whereas keywords are always just :whatever
> in every context.
>
> Uninterned carry a #: dongle *and* require quoting. The justification
> for using them is that they don't pollute memory, since there is no
> global package which hangs on to them. If the Lisp system can
> garbage-collect symbols that were referenced in top-level forms that can
> never be re-executed (without reloading the module), then you have a
> savings in memory by using uinterned symbols.
Bare package names are most often used in code that's only executed at
compile time, so you don't generally have to worry about them polluting
memory.
And even if they do, what's the big deal? How many packages will there
typically be in any Lisp environment, a few dozen? This isn't the
1970's, when we had to worry about every byte of memory.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***