[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Re: learning Lisp

From: root
Subject: Re: [Axiom-developer] Re: learning Lisp
Date: Tue, 6 Dec 2005 18:39:39 -0500

the package system is conceptually simple:

each symbol gets read.
the symbol is looked up in a hash table (called "the current package")
if the symbol is not found 
  then it gets added to the hash table ("interned in the current package")
  else a new symbol is made an added to the hash table.

if a symbol has a package qualifier (something colon symbol as in BOOT:FOO)
then the same "intern" process occurs but we use a different hash table.

a lisp symbol has several parts (a struct):
    function value
    print name 
    property list

notice that every symbol has a package which is a pointer to the hash
table that holds the symbol.   

so packages are just a fancy name for hash tables. 
they hold symbols and are used by the reader to match them.
they provide multiple name spaces so we can have
USER::FOO and BOOT::FOO at the same time. this is
useful if you are using functions from an old lisp
(like VMLisp) which has the same names as the current

there are some standard packages. USER was a standard package
in common lisp version 1 (CLTL1) and common lisp version 2 (CLTL2)
but the great bozons in the sky could not resist renaming it to
COMMON-LISP-USER (which the abbrev CL-USER). this is one of the
changes axiom has to make to become ANSI.

another way to think about packages (implied by the name)
is that you stuff all your random symbols, say foo, into
your own package name (e.g. boot) and then you "export" some
(export '(foo)) as an API. then other packages can "import"
them using "use-package" which "interns" the "exported"
names (copies the hash table entries).

on page 268 Seibel recommends adopting the java convention of
reversing the domain name as in org.axiom-developer.mypackage
which is a horrible idea and he should be publicly flogged
for such a suggestion. but that's just my professional opinion :-)
the ANSI-2 spec will want gro.repoleved-moixa.mypackage. sigh.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]