[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intern

  From: hplabs!NGALL@G.BBN.COM
      My question is: does INTERN (the function) always "intern" (the
      verb).  Also, are there any other functions which "intern," such
      as import, for instance.  Specificially, should INTERN set the
      home package of an uninterned symbol?
  I asked this question a while back (too bad the archives are so hard
  to access!).  My impression was that there was a consensus that IMPORT
  is the function that is responsible for "updating" the package-slot of
  an uninterned symbol (since IMPORT is the only function that can put a
  SYMBOL in a package).
  Guy Steele sent out a list of proposed "clarifications" a few months
  ago (also in the archives).  The clarification for IMPORT was: "If
  symbol has no owner, its package cell is updated."
  	-- Nick

Thanks for the clarification on IMPORT.  I did have a copy of the
clarifications, but hadn't looked them over carefully enough.  I am
certainly satisfied by the new definition of IMPORT, but something
still bothers me about INTERN.  As the reason for having import be
the only function responsible for updating the package slot, you claim that
IMPORT is the only function that can put a SYMBOL in a package.  By this,
do you mean an already existing symbol, or any symbol?  Obviously, if
I type (intern "FOO"), I will put the symbol FOO in the current package (if
it wasn't already available).  If you mean an already existing symbol,
isn't that equivalent to the question I already asked?  I'm not trying
to be picky -- I just don't understand the motivation for restricting
INTERN from setting the home package.  On page 172, CLtL says (for the
function INTERN):  "If the symbol previously was unowned, then the package
it is being interned in becomes its owner (home package); but if the symbol
was previously owned by another package, the other package continues to
own the symbol."  To me, that seems to strongly suggest that INTERN would
have to set the home package on a symbol which doesn't CURRENTLY have a
home package.  As I said before, this creates a problem for the definition
of FIND-SYMBOL since it is defined to be identical to INTERN except that
it can't create a new symbol.  Consider:

(let ((x (intern "FOO")))
  (import x (find-package "BAR"))
  (unintern x)
  (find-symbol "FOO" (find-package "BAR")))
  ;; the defn. in CLtL would imply that x would now be homed in BAR.

John Diamant
Fort Collins Systems Division	UUCP:  {ihnp4,hplabs}!hpfclp!diamant
Hewlett Packard Co.		ARPA/CSNET: diamant%hpfclp@hplabs
Fort Collins, CO