From: JP Massar
Subject: DEFPACKAGE definition question
Date: 
Message-ID: <aldi0118i3gs1feutl15d5p716a83ejllf@4ax.com>
Does anyone understand why the latter restriction (regarding :export
and :intern) found in the definition of DEFPACKAGE in the hyperspec is
there?

"The collection of symbol-name arguments given to the options :shadow,
:intern, :import-from, and :shadowing-import-from must all be
disjoint; additionally, the symbol-name arguments given to :export and
:intern must be disjoint."

Consider (using Allegro):


CG-USER(9): (defpackage :dino (:use :lisp) (:intern "WILMA"))
#<The DINO package>
CG-USER(10): (find-symbol "WILMA" :dino)
DINO::WILMA
:INTERNAL
CG-USER(11): (export 'dino::wilma :dino)
T
CG-USER(12): (find-symbol "WILMA" :dino)
DINO:WILMA
:EXTERNAL
CG-USER(13): (defpackage :bambam (:use :lisp) (:intern "WILMA")
(:export "WILMA"))
Error: When defining package :BAMBAM, symbol name arguments 
given to options :INTERN and :EXPORT must be disjoint.  Common
       arguments are  "WILMA" 
[condition type: PROGRAM-ERROR]



If I can export the symbol after I create it using INTERN in
defpackage, why can't I export it using DEFPACKAGE ?

Thanks.
From: Barry Margolin
Subject: Re: DEFPACKAGE definition question
Date: 
Message-ID: <barmar-D799A9.23452408022005@comcast.dca.giganews.com>
In article <··································@4ax.com>,
 JP Massar <······@alum.mit.edu> wrote:

> Does anyone understand why the latter restriction (regarding :export
> and :intern) found in the definition of DEFPACKAGE in the hyperspec is
> there?
> 
> "The collection of symbol-name arguments given to the options :shadow,
> :intern, :import-from, and :shadowing-import-from must all be
> disjoint; additionally, the symbol-name arguments given to :export and
> :intern must be disjoint."

To keep it simple.  You don't have to check whether a symbol is listed 
in multiple options, to determine what's happening with that symbol.  
Each symbol is listed in just one place, and that makes it clear 
precisely what's going on.

> 
> If I can export the symbol after I create it using INTERN in
> defpackage, why can't I export it using DEFPACKAGE ?

Because when you specify :export, it automatically interns it for you.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***