Re: First multi-file/package prog with lispworks personal edition on windows
- From: Ken Tilton <ken@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Apr 2007 00:31:05 -0400
Kent M Pitman wrote:
Ken Tilton <ken@xxxxxxxxxxxxxxxxxx> writes:
In the first file you load, have:
(defpackage #:my-first-package
(:nicknames #:pkg1)
(:use #:common-lisp)
(:export #:my-first-function))
I recommend breaking the above form off into a separate file. Anyone
who uses this package might want to be able to load the package
definition, even people not planning to call the functions.
Kind of an edge concern, don't you think? Should we scare noobs with those? And I do not program that way.. maybe if one of the six people using Cells asked for that, otherwise....
For example,
someone wanting to process the symbols in the other files. Or someone
planning to define different definitions for the same package (not that
I particularly recommend that).
The informal convention on the Lisp Machines was that every "system"
(approximately, what CL calls a "compilation unit" and what the OP
here thinks of as a set of files) had a pkgdcl.lisp that was just that
package declaration.
Having done this, you can then do
(mapcar #'load '("pkgdcl.lisp" "my-defs.lisp" "my-callers.lisp"))
but you can also break things up differently.
Add a remove-if there is a fasl with a more recent date and you have ASDF beat.
(in-package :pkg1)
(defun my-first-function yada yada
In the second file:
(in-package :pkg1)
(defun my-first-caller ()
(my-first-function))
If you want the second file to be a diff package, do a defpackage
there
or in a separate file, again,
of my-second-package, have it :use the first pkg, then have the
in-package form for the second package and you can reference the first
function.
To load multiple file projects semi-painfully use mk::defsystem or ASDF.
semi-painfully? As upposed to fully painfully? Hmmm.
Fully painfully is clipping in OpenGL. Semi-painful is ASDF.
I assumed the noob was also interested in project management given the multi-file thing, and I guessed wildly they were not lucky enough to be using the AllegroCL Project Manager, so I wanted to recommend the most automated things available, but I also wanted to make clear that ASDF, well, is not all that user-friendly. It's only recommendation is ubiquity, and, once conquered, will however awkwardly provide push-button builds.
kxo
--
http://www.theoryyalgebra.com/
"Algebra is the metaphysics of arithmetic." - John Ray
"As long as algebra is taught in school,
there will be prayer in school." - Cokie Roberts
"Stand firm in your refusal to remain conscious during algebra."
- Fran Lebowitz
"I'm an algebra liar. I figure two good lies make a positive."
- Tim Allen
.
- Follow-Ups:
- Re: First multi-file/package prog with lispworks personal edition on windows
- From: Kent M Pitman
- Re: First multi-file/package prog with lispworks personal edition on windows
- References:
- Prev by Date: Re: First multi-file/package prog with lispworks personal edition on windows
- Next by Date: CL-IRC coding issue
- Previous by thread: Re: First multi-file/package prog with lispworks personal edition on windows
- Next by thread: Re: First multi-file/package prog with lispworks personal edition on windows
- Index(es):
Relevant Pages
|