271 lines
16 KiB
HTML
271 lines
16 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Issue PACKAGE-CLUTTER Writeup</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="../Issues/iss251_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss252.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss253_w.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="../Issues/iss251_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss252.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss253_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue PACKAGE-CLUTTER Writeup</H2>
|
|
|
|
<PRE><B>Status:</B> Accepted v8 (superseding v7) on 15-0 vote, Jun-90<P>
|
|
<B>Issue:</B> <A HREF="iss252.htm">PACKAGE-CLUTTER</A><P>
|
|
<B>References:</B> LISP, USER, SYSTEM packages (p181)<P>
|
|
<P>
|
|
Related issues: <A HREF="iss214.htm">LISP-SYMBOL-REDEFINITION</A>, <A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A>, <P>
|
|
<A HREF="iss238.htm">MAKE-PACKAGE-USE-DEFAULT</A>, <A HREF="iss195.htm">IN-PACKAGE-FUNCTIONALITY</A><P>
|
|
<A HREF="iss174.htm">FUNCTION-NAME</A><P>
|
|
<P>
|
|
<B>Category:</B> CHANGE/CLARIFICATION<P>
|
|
<P>
|
|
<B>Edit history:</B> 07-Jul-88, Version 1 by Pitman<P>
|
|
23-Sep-88, Version 2 by Masinter<P>
|
|
5-Oct-88, Version 3 by Masinter<P>
|
|
7-Oct-88, Version 4 by Masinter (response to KMP)<P>
|
|
8-Dec-88, Version 5 by Masinter<P>
|
|
(add property lists)<P>
|
|
12-Dec-88, Version 6 by Masinter (respond to comments)<P>
|
|
17-Mar-89, Version 7 by Masinter (as amended Jan 89 X3J13)<P>
|
|
3-Jan-90, Version 8 by Barrett (add more cases)<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
CLtL specifies that<P>
|
|
<P>
|
|
``The package named LISP contains the primitives of<P>
|
|
the Common Lisp system. Its external symbols include<P>
|
|
all of the user-visible functions and global variables<P>
|
|
that are present in the Common Lisp system, such as<P>
|
|
<A REL=DEFINITION HREF="../Body/f_car_c.htm#car"><B>CAR</B></A>, <A REL=DEFINITION HREF="../Body/f_car_c.htm#cdr"><B>CDR</B></A>, <A REL=DEFINITION HREF="../Body/v_pkg.htm#STpackageST"><B>*PACKAGE*</B></A>, etc. Almost all other packages will<P>
|
|
want to use LISP so that these symbosl will be accessible<P>
|
|
without qualification.''<P>
|
|
<P>
|
|
It specifies "all" but not "all and only".<P>
|
|
<P>
|
|
Some implementations place their extensions in the Lisp package.<P>
|
|
Nothing in CLtL explicitly prohibits this, but it leads to problems <P>
|
|
in general. For example:<P>
|
|
<P>
|
|
- A user defining a function by a name not mentioned in CLtL may be<P>
|
|
surprised to clobber a system function in some implementations<P>
|
|
<P>
|
|
- In one particular implementation, the variable HELP was a system<P>
|
|
constant, so that ((<A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>LAMBDA</B></A> (HELP) ...HELP...) "Press ? for help.")<P>
|
|
signalled a correctable error (asking what variable to bind<P>
|
|
instead of HELP :-).<P>
|
|
<P>
|
|
<B>Proposal (PACKAGE-CLUTTER:REDUCE):<P>
|
|
</B><P>
|
|
Specify that, not only must the LISP package contain at least all of the<P>
|
|
symbols listed in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>, it will have no other external symbols.<P>
|
|
(The LISP <A REL=DEFINITION HREF="../Body/t_pkg.htm#package"><B>package</B></A> may have additional internal symbols.)<P>
|
|
<P>
|
|
External symbols of the LISP package may have function, macro, or special<P>
|
|
form definitions, <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>setf</B></A> <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> definition, top level value or <A REL=DEFINITION HREF="../Body/d_specia.htm#special"><B>SPECIAL</B></A><P>
|
|
proclamations, or type definitions only if explicitly permitted in the<P>
|
|
specification. That is, a program is valid Common Lisp if it assumes that<P>
|
|
this is true; for example, <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A> will be false for all external symbols of<P>
|
|
the LISP package except those documented to be functions, macros or special<P>
|
|
forms; no <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>setf</B></A> <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> will be defined for such a symbol, and <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A> on<P>
|
|
(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> symbol) will be false; <A REL=DEFINITION HREF="../Body/f_boundp.htm#boundp"><B>BOUNDP</B></A> will be false for all those except those<P>
|
|
documented to be variables, and portable programs can use symbols in the<P>
|
|
LISP package as local lexical variables with the presumption that the<P>
|
|
variables are not proclaimed special, except for those variables specified<P>
|
|
as constants or variables.<P>
|
|
<P>
|
|
No external symbols of the LISP package may have properties with<P>
|
|
property indicators that are either external symbols of packages<P>
|
|
defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> or are otherwise accessible in the USER<P>
|
|
package.<P>
|
|
<P>
|
|
This proposal constrains implementations as to what their<P>
|
|
initial package configuration must be. That is, valid programs<P>
|
|
can assume that the conformal Lisp implementation will not<P>
|
|
have prohibited properties. The proposal <A HREF="iss214.htm">LISP-SYMBOL-REDEFINITION</A><P>
|
|
addresses the converse; that is, what user programs are allowed<P>
|
|
to do.<P>
|
|
<P>
|
|
Eliminate the requirement that the initial Common Lisp system <P>
|
|
have a package named "SYSTEM". Specify that implementations may<P>
|
|
have several other packages available, that these should be<P>
|
|
documented. If it is appropriate, the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> might contain<P>
|
|
as an example that implementations might have a package named<P>
|
|
"SYSTEM".<P>
|
|
<P>
|
|
Clarify that the "USER" package may have additional symbols interned<P>
|
|
within it and that it may :USE other implementation-specific packages.<P>
|
|
<P>
|
|
<P>
|
|
Examples:<P>
|
|
<P>
|
|
#1: The symbol HELP may not be on the LISP package because it is not<P>
|
|
mentioned in CLtL.<P>
|
|
<P>
|
|
#2: The symbol <A REL=DEFINITION HREF="../Body/f_docume.htm#variable"><B>VARIABLE</B></A> is specified to be on the LISP package (because<P>
|
|
it is a valid second argument to the <A REL=DEFINITION HREF="../Body/f_docume.htm#documentation"><B>DOCUMENTATION</B></A> function). Since<P>
|
|
it is not defined as a variable, type, or function, however, it will<P>
|
|
not initially be bound, defined as a type, or defined as a function,<P>
|
|
macro or special form.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
If extra symbols are permitted in the LISP package, users may be surprised<P>
|
|
by relationships between the LISP package and other packages which they<P>
|
|
did not expect, or may be surprised by functionality that they did not<P>
|
|
expect. The degenerate case is:<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:A 'YOU-LOSE)<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:B 'YOU-LOSE)<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:C 'YOU-LOSE) <P>
|
|
...<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:AA 'YOU-LOSE)<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:AB 'YOU-LOSE)<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> LISP:AB 'YOU-LOSE)<P>
|
|
...etc.<P>
|
|
<P>
|
|
Given such an implementation, even things like (<A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>LAMBDA</B></A> (X) X) are not<P>
|
|
valid because they attempt to bind "system constants". It is necessary<P>
|
|
that the programmer be able to know for sure that an arbitrary name is<P>
|
|
"free for use" and best way to conveniently assure this is to <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A><P>
|
|
that the LISP package be unadulterated.<P>
|
|
<P>
|
|
As for the additional definitions, there are situations where additional<P>
|
|
definitions would cause a problem. For example, if a symbol on the Lisp<P>
|
|
package were declared as a special variable even though that value was<P>
|
|
not mentioned in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>, that variable would behave incorrectly when<P>
|
|
used as a lexical variable. Similarly, if a symbol in the lisp package<P>
|
|
were defined as an implementation-dependent special form, problems might<P>
|
|
result if a user redefined or even bound (as by <A REL=DEFINITION HREF="../Body/s_flet_.htm#flet"><B>FLET</B></A> or <A REL=DEFINITION HREF="../Body/s_flet_.htm#macrolet"><B>MACROLET</B></A>) that<P>
|
|
name.<P>
|
|
<P>
|
|
The LISP package is the foothold from which portable programs establish<P>
|
|
their desired environment. Careful control is desirable to make sure<P>
|
|
everyone is starting off on the right foot.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Some implementations have been known to add additional symbols (usually<P>
|
|
functional and/or variable extensions) to the LISP package.<P>
|
|
<P>
|
|
Several implementations have restricted the LISP package to only contain<P>
|
|
those symbols in CLtL. (The exact set was difficult to extract because not all<P>
|
|
LISP package symbols appeared in the index of CLtL.)<P>
|
|
<P>
|
|
Even in those implementations that have only the prescribed symbols in CLtL,<P>
|
|
there can be extra definitions for those symbols. For example, in Symbolics Genera,<P>
|
|
the symbols EVALHOOK, <A REL=DEFINITION HREF="../Body/f_room.htm#room"><B>ROOM</B></A>, and APPLYHOOK<P>
|
|
are spuriously defined as special variables, and the symbol <A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>LAMBDA</B></A> is defined<P>
|
|
as a macro. <P>
|
|
<P>
|
|
<B>Performance Impact:<P>
|
|
</B><P>
|
|
None<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
The actual cost of moving the symbols out of the LISP package in cases<P>
|
|
where they are not already gone is quite small. However, if any<P>
|
|
implementation really has to do this, it may have a number of suppositions<P>
|
|
about what is in what package, and the changes could potentially be extensive.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
This change is upward compatible with any portable program, but users<P>
|
|
of a particular implementation's extensions may be forced to find their<P>
|
|
functions in a different package, so there may be a measurable practical<P>
|
|
cost.<P>
|
|
<P>
|
|
In many cases where an extension symbol FOO is simply expected to have<P>
|
|
been directly available (due to :USE "LISP"), it will work to just just<P>
|
|
do (<A REL=DEFINITION HREF="../Body/f_import.htm#import"><B>IMPORT</B></A> 'new-home-package-for-foo:FOO) where the user's package is<P>
|
|
declared.<P>
|
|
<P>
|
|
More likely the extension symbols would be moved to one or more<P>
|
|
extensions packages, e.g. ACME-COMMON-LISP, so user packages in which<P>
|
|
the extensions were desired could simply :USE the extensions package(s).<P>
|
|
Implementations might want to use this way of conforming with this<P>
|
|
proposal in order to minimize cost to users.<P>
|
|
<P>
|
|
In many cases where an extension symbol FOO is used by explicit package<P>
|
|
prefix, such as LISP:FOO, it should be easy to search for `LISP:FOO' or<P>
|
|
even `LISP:' to find the cases.<P>
|
|
<P>
|
|
<B>Cost of Non-Adoption:<P>
|
|
</B><P>
|
|
The potential for the LISP package to be adulterated and for supposedly<P>
|
|
portable programs to have difficulty getting a foothold in some<P>
|
|
implementations will be `noticeably non-zero'.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Portability of some programs will be enhanced.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
This change probably supports the naive expectation of most programmers<P>
|
|
writing portable code.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
This proposal basically affects what implementors are allowed to do;<P>
|
|
it says that portable programs can rely on a <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> initial package<P>
|
|
<A REL=DEFINITION HREF="../Body/f_docume.htm#structure"><B>structure</B></A> with the same symbols in it. A separate proposal, <P>
|
|
<A HREF="iss214.htm">LISP-SYMBOL-REDEFINITION</A>, discusses the restrictions on portable<P>
|
|
programs as far as redefining LISP symbols.<P>
|
|
<P>
|
|
Whether the USER package may contain symbols other than those <P>
|
|
specified in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> was controversial. The smart programmer<P>
|
|
of portable code will never rely on the contents of the<P>
|
|
USER package. However, if someone wants a completely empty <P>
|
|
package that uses only Lisp, it's easy and portable to create one.<P>
|
|
<P>
|
|
While it would improve portability slightly to disallow additional internal<P>
|
|
symbols in the LISP package (since it affects what <A REL=DEFINITION HREF="../Body/m_do_sym.htm#do-symbols"><B>DO-SYMBOLS</B></A> will do)<P>
|
|
explicitly prohibiting a common practice didn't seem like the best way<P>
|
|
to discourage a possibly troublesome implementation technique. <P>
|
|
<P>
|
|
Implementors should be especially careful about accidentally <P>
|
|
exporting unwanted additional definitions for symbols,e.g., a variable<P>
|
|
definition for EVALHOOK which might show through because of<P>
|
|
an unintended name collision.<P>
|
|
<P>
|
|
It is likely that the recently included portions of the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> (CLOS and<P>
|
|
the signal mechanism) will reside in their own packages. These externally<P>
|
|
defined packages should have the same constraints as outlined for<P>
|
|
the LISP package here.<P>
|
|
<P>
|
|
There has been a suggestion that vendor-specific extensions should<P>
|
|
be placed in a package named like ACME-COMMON-LISP for the "Acme"<P>
|
|
company. <P>
|
|
<P>
|
|
A registry of packages (as well as features, modules and other global<P>
|
|
names) would be useful, although probably not a part of the language<P>
|
|
<A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>, per se.<P>
|
|
<P>
|
|
Barrett and Pitman support superseding version 7 with version 8.<P>
|
|
<P>
|
|
----------<P>
|
|
Additional comments on the write-up:<P>
|
|
<P>
|
|
"This is clearly correct." --Moon (9 Jan 90)<P>
|
|
</PRE>
|
|
<HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|