[Gardeners] How to name symbols
Peter Seibel
peter at gigamonkeys.com
Fri Apr 28 22:01:56 CDT 2006
On Apr 28, 2006, at 7:31 PM, Pascal Bourguignon wrote:
> Since writing a keyword is easier than writing a string, for
> interactive use, it's acceptable to use keywords instead of strings,
> but in programs, I always use strings, to avoid growing indefinitely
> the KEYWORD package.
And if this were c.l.l. someone (Duane Retig, I think, usually does
it) would point out that at may also not matter in compiled code.
That is, if you write:
(defpackage :foo (:use :cl) (:export :bar))
the DEFPACKAGE macro may well translate the keyword symbols into
strings during expansion so a file containing this DEFPACKAGE form
that is compiled with COMPILE-FILE will result in the same code in
the .fasl file as one containing:
(defpackage "FOO" (:use "CL") (:export "BAR"))
and thus will intern the same number of symbols in the KEYWORD
package when the .fasl is loaded in a new Lisp, i.e. none. On the
other hand if you COMPILE-FILE the file and then dump an image, the
image will contain the keyword symbol that were read while compiling
the file. So it depends how you operate.
-Peter
--
Peter Seibel * peter at gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp * http://www.gigamonkeys.com/book/
More information about the Gardeners
mailing list