From: Peter Seibel
Subject: :intern option in DEFPACKAGE?
Date: 
Message-ID: <m3fz89raf9.fsf@javamonkey.com>
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

From: Steven M. Haflich
Subject: Re: :intern option in DEFPACKAGE?
Date: 
Message-ID: <dbrFc.7835$m56.6271@newssvr27.news.prodigy.com>
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.
From: Peter Seibel
Subject: Re: :intern option in DEFPACKAGE?
Date: 
Message-ID: <m3r7rtnn0l.fsf@javamonkey.com>
"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