1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Issues/iss254_w.htm
2024-04-01 10:24:07 +02:00

133 lines
8.8 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-FUNCTION-CONSISTENCY 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/iss253_w.htm">
<LINK REL=UP HREF="../Issues/iss254.htm">
<LINK REL=NEXT HREF="../Issues/iss255_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/iss253_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss254.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss255_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue PACKAGE-FUNCTION-CONSISTENCY Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss254.htm">PACKAGE-FUNCTION-CONSISTENCY</A><P>
<B>References:</B> 11.7 Package System Functions and Variables (pp182-188)<P>
<B>Category:</B> CLARIFICATION/CHANGE<P>
<B>Edit history:</B> 21-Oct-88, Version 1 by Pitman<P>
12-Jan-89, Version 2 by Masinter (add MORE-PERMISSIVE option)<P>
17-Mar-89, Version 3, by Masinter, MORE-PERMISSIVE as<P>
amended &amp; adopted at Jan 89 X3j13<P>
17-Mar-89, Version 4, by Moon, correct amended wording<P>
<P>
<B>Problem Description:<P>
</B><P>
CLtL is vague about whether either or both of package or package name<P>
are permissible in some cases.<P>
<P>
<B>Proposal (PACKAGE-FUNCTION-CONSISTENCY:MORE-PERMISSIVE):<P>
</B><P>
Clarify that it is permissible to pass either a package object<P>
or a package name (symbol or string) in the following situations:<P>
- the :USE argument to <A REL=DEFINITION HREF="../Body/f_mk_pkg.htm#make-package"><B>MAKE-PACKAGE</B></A> or <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A><P>
- the first argument to <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A>, <A REL=DEFINITION HREF="../Body/f_find_p.htm#find-package"><B>FIND-PACKAGE</B></A>, <A REL=DEFINITION HREF="../Body/f_rn_pkg.htm#rename-package"><B>RENAME-PACKAGE</B></A><P>
or <A REL=DEFINITION HREF="../Body/f_del_pk.htm#delete-package"><B>DELETE-PACKAGE</B></A><P>
- the second argument to <A REL=DEFINITION HREF="../Body/f_intern.htm#intern"><B>INTERN</B></A>, <A REL=DEFINITION HREF="../Body/f_find_s.htm#find-symbol"><B>FIND-SYMBOL</B></A>, <A REL=DEFINITION HREF="../Body/f_uninte.htm#unintern"><B>UNINTERN</B></A><P>
- the second argument to <A REL=DEFINITION HREF="../Body/f_export.htm#export"><B>EXPORT</B></A>, <A REL=DEFINITION HREF="../Body/f_unexpo.htm#unexport"><B>UNEXPORT</B></A>, <A REL=DEFINITION HREF="../Body/f_import.htm#import"><B>IMPORT</B></A>,<P>
<A REL=DEFINITION HREF="../Body/f_shdw_i.htm#shadowing-import"><B>SHADOWING-IMPORT</B></A>, and <A REL=DEFINITION HREF="../Body/f_shadow.htm#shadow"><B>SHADOW</B></A><P>
- the first argument (or a member of the list which is the first<P>
argument) to <A REL=DEFINITION HREF="../Body/f_use_pk.htm#use-package"><B>USE-PACKAGE</B></A> or <A REL=DEFINITION HREF="../Body/f_unuse_.htm#unuse-package"><B>UNUSE-PACKAGE</B></A>.<P>
- all <A REL=DEFINITION HREF="../Body/f_pkg_na.htm#package-name"><B>package-name</B></A> arguments in <A REL=DEFINITION HREF="../Body/m_defpkg.htm#defpackage"><B>DEFPACKAGE</B></A> except for the name and<P>
nicknames of the package being defined.<P>
- the first argument to <A REL=DEFINITION HREF="../Body/f_pkg_na.htm#package-name"><B>PACKAGE-NAME</B></A>, <A REL=DEFINITION HREF="../Body/f_pkg_ni.htm#package-nicknames"><B>PACKAGE-NICKNAMES</B></A>, <P>
<A REL=DEFINITION HREF="../Body/f_pkg_us.htm#package-use-list"><B>PACKAGE-USE-LIST</B></A>, or <A REL=DEFINITION HREF="../Body/f_pkg__1.htm#package-used-by-list"><B>PACKAGE-USED-BY-LIST</B></A><P>
- the <A REL=DEFINITION HREF="../Body/t_pkg.htm#package"><B>PACKAGE</B></A> argument to <A REL=DEFINITION HREF="../Body/m_do_sym.htm#do-symbols"><B>DO-SYMBOLS</B></A>.<P>
- the <A REL=DEFINITION HREF="../Body/t_pkg.htm#package"><B>PACKAGE</B></A> argument to <A REL=DEFINITION HREF="../Body/m_do_sym.htm#do-external-symbols"><B>DO-EXTERNAL-SYMBOLS</B></A>.<P>
- the <A REL=DEFINITION HREF="../Body/t_pkg.htm#package"><B>PACKAGE</B></A> argument to <A REL=DEFINITION HREF="../Body/m_do_sym.htm#do-all-symbols"><B>DO-ALL-SYMBOLS</B></A>.<P>
<P>
If <A REL=DEFINITION HREF="../Body/f_find_p.htm#find-package"><B>FIND-PACKAGE</B></A> is given a package object as an argument, it simply<P>
returns it.<P>
<P>
Clarify that the function <A REL=DEFINITION HREF="../Body/f_mk_pkg.htm#make-package"><B>MAKE-PACKAGE</B></A> permits only a package name<P>
as an argument since it does not make sense to create an existing<P>
package.<P>
<P>
Clarify that package nicknames must always be expressed as package<P>
names (symbols or strings) and may never be actual package objects.<P>
<P>
In the list above, <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> may be changed to SELECT-PACKAGE<P>
if IN-PACKAGE-FUNCTIONALITY:NEW-MACRO passes.<P>
<P>
<B>Examples:<P>
</B><P>
(<A REL=DEFINITION HREF="../Body/f_intern.htm#intern"><B>INTERN</B></A> &quot;FOO&quot; &quot;KEYWORD&quot;) =&gt; :FOO<P>
<P>
(<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> *FOO-PACKAGE* (<A REL=DEFINITION HREF="../Body/f_mk_pkg.htm#make-package"><B>MAKE-PACKAGE</B></A> &quot;FOO&quot;))<P>
(<A REL=DEFINITION HREF="../Body/f_rn_pkg.htm#rename-package"><B>RENAME-PACKAGE</B></A> &quot;FOO&quot; &quot;FOO0&quot;)<P>
(<A REL=DEFINITION HREF="../Body/f_pkg_na.htm#package-name"><B>PACKAGE-NAME</B></A> *FOO-PACKAGE*) =&gt; &quot;FOO0&quot;<P>
<P>
<P>
(<A REL=DEFINITION HREF="../Body/f_pkg_na.htm#package-name"><B>PACKAGE-NAME</B></A> &quot;SYS&quot;) might return &quot;SYSTEM&quot;.<P>
<P>
<B>Rationale:<P>
</B><P>
This makes things more consistent.<P>
It also adds a generally useful capability.<P>
<P>
<P>
<B>Current Practice:<P>
</B><P>
Symbolics Genera &amp; Lucid permit strings as package names.<P>
Symbolics Cloe does not permit strings as package names.<P>
In Lucid <A REL=DEFINITION HREF="../Body/f_find_p.htm#find-package"><B>FIND-PACKAGE</B></A> and <A REL=DEFINITION HREF="../Body/m_in_pkg.htm#in-package"><B>IN-PACKAGE</B></A> <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> names.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Small.<P>
<P>
<B>Cost to Users:<P>
</B><P>
None. This change is upward compatible.<P>
<P>
<B>Cost of Non-Adoption:<P>
</B><P>
Implementations would continue to vary gratuitously, leaving a potential<P>
for portability problems.<P>
<P>
<B>Benefits:<P>
</B><P>
The cost of non-adoption is avoided.<P>
<P>
<B>Aesthetics:<P>
</B><P>
This makes things more regular, and so presumably more aesthetic.<P>
<P>
<B>Discussion:<P>
</B><P>
Pitman ran across this problem while trying to port Macsyma to various<P>
implementations. Discussion with other maintainers of portable programs<P>
shows this is a common source of aggravation in portable code.<P>
<P>
It would be possible to say that <A REL=DEFINITION HREF="../Body/f_mk_pkg.htm#make-package"><B>MAKE-PACKAGE</B></A> took package objects as<P>
arguments and just returned that package. That might have limited<P>
usefulness on rare occasions, but mostly seemed too far out in left<P>
field to bother suggesting it.<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>