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


On page 172 of CLtL, the verb "intern" is defined.  It is stated that one
action performed is setting the home package of a symbol which doesn't already
have one.  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?

  (setq sym (gensym))	; make an uninterned symbol
  (import sym)		; make it available in the current package

; assuming import did not set the home package (is this a correct assumption?):

  (intern (symbol-name sym))
			; (note: intern takes a string, not symbol, argument)
			; looks up (interns?) the symbol
			; should intern set the home package?

; then consider:

  (find-symbol (symbol-name sym))
			; find-symbol is defined to be just like intern,
			; but does not make a new symbol
			; in this case it finds an existing symbol,
			; so should find-symbol set the home package?

relevant material from CLtL

page 172
  a symbol is interned in a package if
    1) it is accessible in that package
    2) its package cell is not NIL  (any package may own it)

  to intern a symbol in a package
    1) is performed by the function INTERN
    2) makes the symbol interned in the package, unless it already was
    3) if the symbol was previously unowned (its package cell was NIL)
	then the package it is being interned in becomes its owner
	else the package cell is not changed

page 184

   the function INTERN sets the package cell if it must create a new symbol,
   but no mention is made of setting the package if it finds an existing
   unowned symbol

page 185

   the function FIND-SYMBOL is identical to INTERN except when no symbol is
   found, in which case it returns NIL

page 186
   the function IMPORT makes symbols "internal symbols" in a package
   does this imply that they are interned in the package?

My feeling on this is that INTERN should set the home package if the symbol
currently has none, but that FIND-SYMBOL should not.  If this is correct,
then the definition of FIND-SYMBOL on page 185 is misleading.

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