[Openmcl-devel] Docs on defpackage, in-package, use-package, provides and require

Gary Byers gb at clozure.com
Mon Aug 16 05:24:19 PDT 2004



On Mon, 16 Aug 2004, Andrew P. Lentvorski, Jr. wrote:

> Could someone point me to some OpenMCL documentation on how and when to
> use the various package and module stuff?  I read Erann Gat's "The
> Complete Idiots Guide to Common Lisp Packages", but I still don't
> understand how it all goes together.
>
> Specifically, I am trying to get "clos-unit" to work as a package, but
> I seem to be missing something.  I would like to do something like:
>
> (load "clos-unit")

I assume that the file "clos-unit" defines a package named CLOS-UNIT.

> (use-package :clos-unit)

This would make the external symbols in CLOS-UNIT accessible in the
current package (whatever it is).  There may already be distinct symbols
accessible in the current package that conflict with (have the same name
as) those external CLOS-UNIT symbols, and those conflicts would have
to be resolved by the user (or by some restarts/handlers wrapped around
all of this.)

It's very hard for a program to modify an arbitrary package (or the
CL-USER package) this way; such a program would have to make a lot
of assumptions about the state of the package it's modifying.  I've
seen and used systems that were distributed this way (that tried
to install themselves in CL-USER); whether they worked or not depended
on what was in my init file and on what I'd typed and loaded before
loading the system in question, and in some cases it depended on what
was already accessible in CL-USER (which is implementation-dependent.)

>
> or just:
>
> (require :clos-unit)
>
> and have it all work.

If doing that REQUIRE made it possible for me to do:

? (clos-unit:something-interesting)

then I'd say that it worked (according to my expectations).

If that REQUIRE tried to make it possible for me to do

? (something-interesting)	; reference CLOS-UNIT:SOMETHING-INTERESTING

and that attempt failed (perhaps because I'd already defined
CL-USER::SOMETHING-INTERESTING, or because I'm using Brand X CL, in which
BRAND-X:SOMETHING-INTERESTING is already accessible in CL-USER), then I'd
probably say that things didn't work too well.

>
> Thanks,
> -a
>

I'm not sure if I answered your question ...

> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list