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

93 lines
5.7 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-DOCUMENTATION 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/iss122_w.htm">
<LINK REL=UP HREF="../Issues/iss123.htm">
<LINK REL=NEXT HREF="../Issues/iss124_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/iss122_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss123.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss124_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue DEFVAR-DOCUMENTATION Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss123.htm">DEFVAR-DOCUMENTATION</A><P>
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A>, <A REL=DEFINITION HREF="../Body/m_defpar.htm#defparameter"><B>DEFPARAMETER</B></A>, <A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> (pp68-9)<P>
<B>Category:</B> CLARIFICATION<P>
<B>Edit history:</B> 30-Jun-87, Version 1 by Pitman<P>
23-Nov-87, Version 2 by Masinter<P>
<P>
<B>Problem Description:<P>
</B><P>
CLtL is not explicit about whether the documentation part of <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A>,<P>
<A REL=DEFINITION HREF="../Body/m_defpar.htm#defparameter"><B>DEFPARAMETER</B></A>, and <A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> special forms is evaluated.<P>
<P>
<B>Proposal (DEFVAR-DOCUMENTATION:UNEVALUATED):<P>
</B><P>
Clarify that the documentation part of <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A>, <A REL=DEFINITION HREF="../Body/m_defpar.htm#defparameter"><B>DEFPARAMETER</B></A>, and <A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A><P>
special forms is not evaluated. That is, it must be a literal string, not a form<P>
which evaluates to a string.<P>
<P>
<B>Examples:<P>
</B><P>
(<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> *MY-VARIABLE* (CONSTRUCT-INITIAL-VALUE) &quot;A <A REL=DEFINITION HREF="../Body/f_docume.htm#documentation"><B>documentation</B></A> string&quot;) ; OK<P>
(<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A> *MY-VARIABLE* (CONSTRUCT-INITIAL-VALUE) GENERIC-DOCUMENTATION-STRING) ;<P>
would be an error<P>
<P>
<B>Rationale:<P>
</B><P>
To ensure portability, implementations must agree on whether or not this<P>
position is evaluated. Specifying that the position is unevaluated is the<P>
conservative thing to suggest, and consistent with the (unevaluated)<P>
documentation strings in <A REL=DEFINITION HREF="../Body/m_defun.htm#defun"><B>DEFUN</B></A>, <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A>.<P>
<P>
<B>Current Practice:<P>
</B><P>
Some implementations evaluate this position. Others do not. <P>
<P>
<B>Cost to implementors:<P>
</B><P>
Implementations that did not already check might usefully add a check in the<P>
macro expansion for <A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>DEFVAR</B></A>, <A REL=DEFINITION HREF="../Body/m_defpar.htm#defparameter"><B>DEFPARAMETER</B></A> and <A REL=DEFINITION HREF="../Body/m_defcon.htm#defconstant"><B>DEFCONSTANT</B></A> to assert that the<P>
<A REL=DEFINITION HREF="../Body/f_docume.htm#documentation"><B>DOCUMENTATION</B></A>, if supplied, was a string. The change is likely trivial.<P>
<P>
<B>Cost to users:<P>
</B><P>
Code which uses other than a literal string is not portable, so no portable<P>
programs will be broken. Some non-portable programs which rely on a particular<P>
vendor's interpretation would have to be rewritten. Automatic tools to detect<P>
most offending cases could trivially be constructed. (We know of no current<P>
uses.)<P>
<P>
<B>Benefits:<P>
</B><P>
Code portability would be improved. Some programming environment tools might<P>
assume that documentation strings were determinable without evaluation.<P>
<P>
<B>Aesthetics:<P>
</B><P>
Slight improvement; this implies consistent treatment for documentation strings<P>
in all defining forms.<P>
<P>
<B>Discussion:<P>
</B><P>
We think this is a good idea.<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>