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

When is a package name equivalent to a package?



    Return-path: <@MIT-MC.ARPA,@SU-AI.ARPA:Moon@STONY-BROOK.SCRC.Symbolics.COM>
    Received: from MIT-MC.ARPA by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 223502; 24 Apr 85 21:10:54-EST
    Received: from SU-AI.ARPA by MIT-MC.ARPA; 24 APR 85 21:00:04 EST
    Received: from SCRC-STONY-BROOK.ARPA by SU-AI.ARPA with TCP; 24 Apr 85  17:50:03 PST
    Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 223474; Wed 24-Apr-85 20:49:47-EST
    Date: Wed, 24 Apr 85 20:50 EST
    From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
    Subject: When is a package name equivalent to a package?
    To: Rob MacLachlan <RAM@CMU-CS-C.ARPA>
    cc: Jon White <JLW@SU-AI.ARPA>, common-lisp@SU-AI.ARPA
    In-Reply-To: <RAM.12105714157.BABYL@CMU-CS-C.ARPA>
    Message-ID: <850424205010.3.MOON@EUPHRATES.SCRC.Symbolics.COM>

	Date: Wed, 24 Apr 1985  10:13 EST
	From: Rob MacLachlan <RAM@CMU-CS-C.ARPA>

	    Date: Tuesday, 23 April 1985  01:30-EST
	    From: Jon White <JLW at SU-AI.ARPA>

	    There is such consistency in this choice of phraseology that I take it to 
	    mean that unless there is a clear statement that the argment must be a 
	    package datatype, then it is permissible for it to be anything reasonably 
	    coerceible to a package.  In this case, (intern ... 'KEYWORD) is the same 
	    as  (intern ... "KEYWORD") and (intern ... (find-package "KEYWORD"))

	Does everyone agree that this is correct?  If this is the case, then
	may *package* be random things also?  Currently Spice Lisp requires
	every package argument to be a package.

    I think the manual is quite clear.

    p.183 requires that the value of *package* be a package.

    p.182 specifies that certain functions, including INTERN, shall accept strings
    and symbols in place of packages.  As is unfortunately typical of the CLM,
    this specification is not repeated in the documentation of each of the affected
    functions, so it's quite easy to overlook.

I wonder if it wouldn't be worth introducing a PACKAGE-BIND special form, as in:
 (DEFMACRO PACKAGE-BIND (PACKAGE &BODY FORMS)
   `(LET ((*PACKAGE* (FIND-PACKAGE ,PACKAGE))) ,@FORMS))
just so users would never need to explicitly call FIND-PACKAGE.

Sure enough, I just checked and there's an SI:PKG-BIND special form which does
exactly that on the LispM so someone must have agreed with this suggestion...