183 lines
11 KiB
HTML
183 lines
11 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 IN-PACKAGE-FUNCTIONALITY 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/iss194_w.htm">
|
||
|
<LINK REL=UP HREF="../Issues/iss195.htm">
|
||
|
<LINK REL=NEXT HREF="../Issues/iss196_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/iss194_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss195.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss196_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
|
||
|
|
||
|
<H2>Issue IN-PACKAGE-FUNCTIONALITY Writeup</H2>
|
||
|
|
||
|
<PRE><B>Status:</B> proposal MAR89-X3J13 passed, as amended, Mar 89 X3J13<P>
|
||
|
<B>Issue:</B> <A HREF="iss195.htm">IN-PACKAGE-FUNCTIONALITY</A><P>
|
||
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> (p182-183)<P>
|
||
|
<B>Category:</B> CHANGE<P>
|
||
|
<B>Edit history:</B> 07-Jul-88, Version 1 by Pitman<P>
|
||
|
7-Oct-88, Version 2 by Masinter (discussion)<P>
|
||
|
8-Dec-88, Version 3 by Masinter<P>
|
||
|
12-Dec-88, Version 4 by Masinter<P>
|
||
|
20-Jan-89, Version 5 by Loosemore<P>
|
||
|
30-Jan-89, Version 6 by Loosemore<P>
|
||
|
10-Mar-89, Version 7 by Loosemore<P>
|
||
|
15-Mar-89, Version 8 by Masinter (add back SELECT-ONLY)<P>
|
||
|
9-Apr-89, Verison 9 by Masinter, as amended Mar 89 X3J13,<P>
|
||
|
and discussion updated.<P>
|
||
|
<P>
|
||
|
Related-Issues: <A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A> (passed)<P>
|
||
|
<A HREF="iss063.htm">COMPILE-FILE-SYMBOL-HANDLING</A><P>
|
||
|
<P>
|
||
|
<B>Problem Description:<P>
|
||
|
</B><P>
|
||
|
There are two typical uses for <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> -- to define/create a package<P>
|
||
|
and to select a package. The fact that these two purposes have been<P>
|
||
|
given to the same function has led to reduced error checking.<P>
|
||
|
<P>
|
||
|
A more general problem is that the "Put In Seven Extremely Randoms" <P>
|
||
|
convention described in CLtL is now recognized by many people as being<P>
|
||
|
unsatisfactory for both package definition and package selection.<P>
|
||
|
The <A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A> macro provides a much cleaner mechanism for package<P>
|
||
|
definition, but there is still a need for a convenient way to select<P>
|
||
|
a package that has well-defined compilation semantics.<P>
|
||
|
<P>
|
||
|
<P>
|
||
|
<B>Proposal (IN-PACKAGE-FUNCTIONALITY:MAR89-X3J13):<P>
|
||
|
</B><P>
|
||
|
Change <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> from a function to a macro:<P>
|
||
|
<P>
|
||
|
<A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> name [macro]<P>
|
||
|
<P>
|
||
|
This macro causes <A REL=DEFINITION HREF="../Body/v_pkg.htm#STpackageST"><B>*PACKAGE*</B></A> to be set to the package named NAME,<P>
|
||
|
which must be a symbol or string. An error is signalled if the<P>
|
||
|
package does not already exist. Everything this macro does is also<P>
|
||
|
performed at compile time if the call appears at top-level.<P>
|
||
|
<P>
|
||
|
Remove the second paragraph of section 11.7 in CLtL. (This includes<P>
|
||
|
the requirement for special compile-time treatment of the various<P>
|
||
|
package functions.)<P>
|
||
|
<P>
|
||
|
Rationale:<P>
|
||
|
<P>
|
||
|
This could allow improved error checking and modularity, with only<P>
|
||
|
minimal loss of functionality.<P>
|
||
|
<P>
|
||
|
Making <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> a macro rather than a function means that there<P>
|
||
|
is no need to <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> <A REL=DEFINITION HREF="../Body/f_cmp_fi.htm#compile-file"><B>COMPILE-FILE</B></A> to handle it specially. Since<P>
|
||
|
<A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A> is also defined to side-effect the compilation environment,<P>
|
||
|
there is no need to <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> any of the package functions to be treated<P>
|
||
|
specially by the compiler.<P>
|
||
|
<P>
|
||
|
The language in section 11.7 of CLtL puts the burden on<P>
|
||
|
implementations of ensuring that all symbols in a file which is<P>
|
||
|
compiled and loaded end up in the same package that they would if the<P>
|
||
|
source file were loaded interpretively. No implementation can<P>
|
||
|
possibly meet this requirement because, in general, the runtime<P>
|
||
|
behavior of the program cannot be predicted by the compiler.<P>
|
||
|
<P>
|
||
|
Current Practice:<P>
|
||
|
<P>
|
||
|
Probably no one implements this behavior exactly since it's an <P>
|
||
|
incompatible change to CLtL.<P>
|
||
|
<P>
|
||
|
Cost to Implementors:<P>
|
||
|
<P>
|
||
|
The SELECT-PACKAGE macro can be implemented trivially by using <P>
|
||
|
<A REL=DEFINITION HREF="../Body/s_eval_w.htm#eval-when"><B>EVAL-WHEN</B></A> in its expansion:<P>
|
||
|
<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/m_defmac.htm#defmacro"><B>defmacro</B></A> select-package (name)<P>
|
||
|
`(<A REL=DEFINITION HREF="../Body/s_eval_w.htm#eval-when"><B>eval-when</B></A> (<A REL=DEFINITION HREF="../Body/f_eval.htm#eval"><B>eval</B></A> <A REL=DEFINITION HREF="../Body/f_cmp.htm#compile"><B>compile</B></A> <A REL=DEFINITION HREF="../Body/f_load.htm#load"><B>load</B></A>)<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>setq</B></A> <A REL=DEFINITION HREF="../Body/v_pkg.htm#STpackageST"><B>*package*</B></A><P>
|
||
|
(<A REL=DEFINITION HREF="../Body/a_or.htm#or"><B>or</B></A> (<A REL=DEFINITION HREF="../Body/f_find_p.htm#find-package"><B>find-package</B></A> ',name)<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/a_error.htm#error"><B>error</B></A> "Package ~s does <A REL=DEFINITION HREF="../Body/a_not.htm#not"><B>not</B></A> exist." ',name)))))<P>
|
||
|
<P>
|
||
|
The changes required to <A REL=DEFINITION HREF="../Body/f_cmp_fi.htm#compile-file"><B>COMPILE-FILE</B></A> to remove the magic treatment<P>
|
||
|
of the package functions are also likely to be small.<P>
|
||
|
<P>
|
||
|
Cost to Users:<P>
|
||
|
<P>
|
||
|
In most cases, minor syntactic changes to some files would be<P>
|
||
|
necessary. Programmers that are now using the "Put In Seven<P>
|
||
|
Extremely Randoms" convention will probably find it straightforward<P>
|
||
|
to convert their code to do a <A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A> followed by a <P>
|
||
|
SELECT-PACKAGE.<P>
|
||
|
<P>
|
||
|
Cost of Non-Adoption:<P>
|
||
|
<P>
|
||
|
The specification of <A REL=DEFINITION HREF="../Body/f_cmp_fi.htm#compile-file"><B>COMPILE-FILE</B></A> will be much more difficult to<P>
|
||
|
understand.<P>
|
||
|
<P>
|
||
|
The <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> will <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> compilers to solve the halting problem.<P>
|
||
|
<P>
|
||
|
Benefits:<P>
|
||
|
<P>
|
||
|
Modular package declarations would be encouraged and errors due<P>
|
||
|
to demand-creation of packages would be easier to detect.<P>
|
||
|
<P>
|
||
|
The specification of <A REL=DEFINITION HREF="../Body/f_cmp_fi.htm#compile-file"><B>COMPILE-FILE</B></A> will be simplified.<P>
|
||
|
<P>
|
||
|
There will be a clear statement of the requirements for program<P>
|
||
|
conformance, as relating to usage of packages.<P>
|
||
|
<P>
|
||
|
Aesthetics:<P>
|
||
|
<P>
|
||
|
The fact that <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> is currently ambiguous about intent (whether<P>
|
||
|
the package should exist already or not) is clearly not aesthetic.<P>
|
||
|
Removing it can't be any worse.<P>
|
||
|
<P>
|
||
|
The fact that the currently stated requirements for handling of<P>
|
||
|
the package functions by the compiler are not implementable is<P>
|
||
|
clearly not aesthetic.<P>
|
||
|
<B>Discussion:<P>
|
||
|
</B><P>
|
||
|
The dual use of <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> has not been helpful and is confusing.<P>
|
||
|
<P>
|
||
|
This is an incompatible change.<P>
|
||
|
<P>
|
||
|
KMP's notes of the Mar 89 X3J13:<P>
|
||
|
<P>
|
||
|
On Tuesday, we took a straw poll.<P>
|
||
|
0 opposed both proposals.<P>
|
||
|
15 liked NEW-MACRO.<P>
|
||
|
7 liked SELECT-ONLY.<P>
|
||
|
``Keeping <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> makes no difference to compatibility.'' --Moon<P>
|
||
|
Pitman moved to amend this to say "deprecate" instead of remove.<P>
|
||
|
The motion to amend failed 3-N.<P>
|
||
|
The NEW-MACRO proposal passed unamended 12-4.<P>
|
||
|
<P>
|
||
|
On Thursday, Aaron Larson and JonL asked that the issue be reconsidered.<P>
|
||
|
The motion to reconsider passed N-1.<P>
|
||
|
There was a motion to rename the SELECT-PACKAGE which we'd voted in to<P>
|
||
|
<A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> -- so that the compatible syntax (<A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> "FOO") would work<P>
|
||
|
in CLtL and ANSI CL.<P>
|
||
|
Steele requested verbal clarification that we were not trying to solve<P>
|
||
|
the ``dusty file'' problem but rather to make it possible to write new code<P>
|
||
|
that worked in old and new situations -- it was agreed that this was a<P>
|
||
|
correct characterization of the proposal.<P>
|
||
|
JonL's amendment passed 13-1.<P>
|
||
|
Then the amended proposal was voted in 14-0.<P>
|
||
|
<P>
|
||
|
The net effect is that NEW-MACRO passed with the name of SELECT-PACKAGE<P>
|
||
|
changed to <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A>.<P>
|
||
|
<P>
|
||
|
<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>
|