Okay, maybe I'm just getting slow in my old age but is there some
actual reason that the :intern option to DEFPACKAGE would ever be
useful? Or was it just put in for completeness sake so that DEFPACKAGE
can do everything that could otherwise be done using MAKE-PACKAGE and
some combination of package manipulation functions?
-Peter
--
Peter Seibel ·····@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
Peter Seibel wrote:
> Okay, maybe I'm just getting slow in my old age but is there some
> actual reason that the :intern option to DEFPACKAGE would ever be
> useful? Or was it just put in for completeness sake so that DEFPACKAGE
> can do everything that could otherwise be done using MAKE-PACKAGE and
> some combination of package manipulation functions?
Suppose you have a file of defpackage forms that create the package
inheritance structure for your application. Suppose you want package b
to import some symbol from package a, but that symbol is not for general
use and therefore not exported from package a.
It is necessary for the symbol to exist in a before it can be imported
by b.
(defpackage :a
(:export ...)
(:intern :my-private-function))
(defpackage :b
(:use :a)
(:import-from :a :my-private-function))
I don't recommend this kind of nonsense, of course.
=====
Any large, aged C++ application will eventually resemble a rerun of
Friends, full of cheap puns about members, except that it won't compile
in 22 minutes.
"Steven M. Haflich" <·················@alum.mit.edu> writes:
> Peter Seibel wrote:
>
>> Okay, maybe I'm just getting slow in my old age but is there some
>> actual reason that the :intern option to DEFPACKAGE would ever be
>> useful? Or was it just put in for completeness sake so that
>> DEFPACKAGE can do everything that could otherwise be done using
>> MAKE-PACKAGE and some combination of package manipulation
>> functions?
>
> Suppose you have a file of defpackage forms that create the package
> inheritance structure for your application. Suppose you want package
> b to import some symbol from package a, but that symbol is not for
> general use and therefore not exported from package a.
>
> It is necessary for the symbol to exist in a before it can be
> imported by b.
Okay. That's a reason. Not a great reason. But a reason.
> (defpackage :a
> (:export ...)
> (:intern :my-private-function))
>
> (defpackage :b
> (:use :a)
> (:import-from :a :my-private-function))
>
> I don't recommend this kind of nonsense, of course.
Agreed.
-Peter
--
Peter Seibel ·····@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp