How can I access code that is unpackaged from within packaged code? For
instance, if I were to have a utilities file which is unpackaged and
several packages which rely on the utilities, how would I refer to the
utility functions from within one of the packages?
Lowell
In article <············@mughi.cs.ubc.ca>, Lowell wrote:
> How can I access code that is unpackaged from within packaged code? For
> instance, if I were to have a utilities file which is unpackaged and
> several packages which rely on the utilities, how would I refer to the
> utility functions from within one of the packages?
Nothing's truly unpackaged. The initial package is, by default,
COMMON-LISP-USER. If you load a file without specifying a package, it
will probably be loaded into the COMMON-LISP-USER package.
If that's the case, you could refer to the utility function FOO as
CL-USER:FOO, or :use "CL-USER" in the defpackage.
See http://www.lispworks.com/reference/HyperSpec/Body/v_pkg.htm for
some info about it.
Zach
Zachary Beane wrote:
> In article <············@mughi.cs.ubc.ca>, Lowell wrote:
>
>>How can I access code that is unpackaged from within packaged code? For
>>instance, if I were to have a utilities file which is unpackaged and
>>several packages which rely on the utilities, how would I refer to the
>>utility functions from within one of the packages?
>
>
> Nothing's truly unpackaged. The initial package is, by default,
> COMMON-LISP-USER. If you load a file without specifying a package, it
> will probably be loaded into the COMMON-LISP-USER package.
>
> If that's the case, you could refer to the utility function FOO as
> CL-USER:FOO, or :use "CL-USER" in the defpackage.
That will not work as reading in CL-USER does not export the symbols.
You'd have to use CL-USER::FOO to refer to the symbol.
Anyway. Learning about packages is time well spent.
Cheers
--
Marco