[CM] Packages again (was: more about CLM/CMUCL problem)

Torsten Anders t.anders@qub.ac.uk
27 Nov 2002 16:53:48 +0000


Dear Dave,

Sorry, I can not help you with your actual question.

Just a note on Lisp packages again. Your init file looks like you expect
the 'in-package' form to load anything. But the only purpose of Lisp
packages is to avoid name clashes, e.g. for functions with the same
name. You may include all symbols, functions etc. of some lisp program
in an own package. The 'in-package' macro then swaps the namespace for
all symbols etc. you use without package labeling. Actually it is the
same concept as packages in Java which you may know (but Java packages
can be nested).

* (in-package :cl-user)

* (between 10 20)	; cm function is not recognized
Warning: This function is undefined:
  BETWEEN
...
* (cm::between 10 20)	; OK with package marking
17
* (in-package :cm)

* (between 10 20)	; OK when you are in the CM package
13

In other word: your current init file as preobably no effect at all.
Obviously the programs CM, CLM and CMN are already loaded -- otherwise
you would get an error switching into their packages ;-)

There is no build-in high-level facility in Lisp to collect, e.g., all
your files of a Lisp program in a module, which can be loaded as a
single unit. But there are several Lisp extensions to do this, most
often they are called defsystem.

Kind regards,
Torsten

PS: More information on packages can be found in the Common Lisp
reference:
http://www.lispworks.com/reference/HyperSpec/Body/11_.htm

On Wed, 2002-11-27 at 15:58, Dave Phillips wrote:
>   cmlisp.init includes these statements:
> 
> 	(in-package :clm)
> 	(in-package :cmn)
> 	(in-package :cm)
-- 
Torsten Anders
Sonic Arts Research Centre
Queens University Belfast
Tel: +44 28 9027 4831