96 lines
5 KiB
HTML
96 lines
5 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 DEFVAR-INITIALIZATION 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/iss124_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss125.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss126_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/iss124_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss125.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss126_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue DEFVAR-INITIALIZATION Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss125.htm">DEFVAR-INITIALIZATION</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> (p68)<P>
|
|
<B>Category:</B> CLARIFICATION/CHANGE<P>
|
|
<B>Edit history:</B> Version 1 by Pitman 02/26/87<P>
|
|
Version 2 by cleanup committee 15-Mar-87 14:45:18<P>
|
|
Version 3 by Masinter (format) 15-Mar-87 18:34:28<P>
|
|
Version 4 by Masinter 5-Jun-87<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
The description of <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> on p.68 is not adequately clear on what<P>
|
|
happens if an initialization value is not provided, as in (<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> FOO).<P>
|
|
Does this initialize the variable?<P>
|
|
<P>
|
|
<B>Proposal (DEFVAR-INITIALIZATION:CONSERVATIVE):<P>
|
|
</B><P>
|
|
If the one-argument form of <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> is used, the value (or lack of value)<P>
|
|
of the variable is not changed.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
In parent languages to CL, such behavior was documented. The omission of<P>
|
|
clear documentation in CL is presumably an accident.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Most implementations already do not initialize the variable. Some<P>
|
|
implementations, however, assume that the missing initial value defaults<P>
|
|
to <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> and assume that the variable is always to be initialized if<P>
|
|
unbound.<P>
|
|
<P>
|
|
<B>Adoption Cost:<P>
|
|
</B><P>
|
|
Some implementations suffer a minor incompatible change. The<P>
|
|
modification to systems is presumably trivial.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
It's sometimes useful to have the ability to declare a variable without<P>
|
|
initializing it. More importantly, though, <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> is used by lots of<P>
|
|
users in every implementation and it deserves uniform treatment.<P>
|
|
<P>
|
|
<B>Conversion Cost:<P>
|
|
</B><P>
|
|
It's stylistically poor to be relying on the variable to be initialized<P>
|
|
without writing the initial value explicitly anyway. Except for very<P>
|
|
rare situations where a conditional action is taken based on a <A REL=DEFINITION HREF="../Body/f_boundp.htm#boundp"><B>BOUNDP</B></A><P>
|
|
test of the variable, user programs are unlikely to be affected in<P>
|
|
practice.<P>
|
|
<P>
|
|
Very few user programs are likely to be affected. The incidence rate is<P>
|
|
probably sufficiently low that the issue of automatic tools for<P>
|
|
conversion is irrelevant.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
No significant issues are obvious.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
The cleanup committee generally supports this clarification.<P>
|
|
<P>
|
|
[Version 3 was distributed at the last X3J13 meeting. This version has<P>
|
|
changed only to bring it in line with the current proposal format.]<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>
|