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

package question



    Date: 24 Feb 1988 19:19-PST
    From: David Bein <pyrnj!pyramid!bein@rutgers.edu>

[Why do 

    Suppose we have the following:

	    * *PACKAGE*
	    #<A package named USER> ;
	    * (SETQ P 'LISP::NEW-SYMBOL)
	    LISP::NEW-SYMBOL ;
	    * (IMPORT P *PACKAGE*)
	    T ;
	    * P
	    NEW-SYMBOL ;
	    * (UNINTERN P (SYMBOL-PACKAGE P))
	    T ;
	    * P
	    #:NEW-SYMBOL
	    * (FIND-SYMBOL "NEW-SYMBOL" *PACKAGE*)
	    #:NEW-SYMBOL ;
	    :INTERNAL ;
	    * (EQ * P)
	    T ;
	    * 'NEW-SYMBOL
	    #:NEW-SYMBOL
	    * (EQ * P)
	    T ;

    We have an inconsistency here since printing does not equal reading.
    Should the reader give the symbol a home if it does not have one?
    Or should the printer be noticing that a symbol with no home is
    in fact accessible in the current package (and not prefix with #:)?

Print-read consistency is only guaranteed for interned symbols [CLtL
p.173]; a symbol is uninterned if it has no home package, whether or not
it is accessible in any package.  And on p.176, CLtL says that #:BAR
syntax is used "when the symbol BAR is uninterned (has no home package),
even in the pathological case that BAR is uninterned but nevertheless
somehow accessible in the current package."  You have created such a
pathological case.  And the description of UNINTERN on p.185 says that
it should be used with caution because it "changes the state of the
package system in such a way that the consistency rules do not hold
across the change."

	    * (IMPORT P *PACKAGE*)
	    T ;
	    * P
	    NEW-SYMBOL ;
	    * 'NEW-SYMBOL
	    NEW-SYMBOL ;
	    * (EQ * P)
	    T ;

    Is IMPORT doing the right thing by giving the symbol a home package
    if it does not have one?

This issue was addressed by the X3J13 Cleanup subcommittee, in issue
IMPORT-SETF-SYMBOL-PACKAGE.  A decision about this was made last June;
unfortunately, I don't recall specifically what the decision was, but
I'll wager we made the above valid.

                                                  barmar