128 lines
8 KiB
HTML
128 lines
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 ADJUST-ARRAY-FILL-POINTER 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/iss003_w.htm">
|
||
|
<LINK REL=UP HREF="../Issues/iss004.htm">
|
||
|
<LINK REL=NEXT HREF="../Issues/iss005_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/iss003_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss004.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss005_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
|
||
|
|
||
|
<H2>Issue ADJUST-ARRAY-FILL-POINTER Writeup</H2>
|
||
|
|
||
|
<PRE><B>Issue:</B> <A HREF="iss004.htm">ADJUST-ARRAY-FILL-POINTER</A><P>
|
||
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> (p297)<P>
|
||
|
<B>Category:</B> CLARIFICATION<P>
|
||
|
<B>Edit history:</B> 15-Mar-88, Version 1 by Pitman<P>
|
||
|
<P>
|
||
|
<B>Problem Description:<P>
|
||
|
</B><P>
|
||
|
CLtL does not specify clearly the effect of <A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> on the fill<P>
|
||
|
pointer.<P>
|
||
|
<P>
|
||
|
<B>Proposal (ADJUST-ARRAY-FILL-POINTER:MINIMAL):<P>
|
||
|
</B><P>
|
||
|
Clarify that the :FILL-POINTER keyword argument to <A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> is treated<P>
|
||
|
as follows...<P>
|
||
|
<P>
|
||
|
If :FILL-POINTER argument is not given, then the <A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>fill-pointer</B></A> of the array<P>
|
||
|
to be adjusted (if any) is left alone. It is an error to adjust an array<P>
|
||
|
to a size smaller than its fill pointer without specifying the :FILL-POINTER<P>
|
||
|
option so that its <A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>fill-pointer</B></A> is properly adjusted in the process.<P>
|
||
|
<P>
|
||
|
If supplied, the :FILL-POINTER argument must be either an integer between 0<P>
|
||
|
and the new size of the array, the symbol T (indicating that the new size<P>
|
||
|
of the array should be used), or the symbol <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> (indicating that the fill<P>
|
||
|
pointer should left as it is -- as if the :FILL-POINTER option had not been<P>
|
||
|
specified).<P>
|
||
|
<P>
|
||
|
An error is signalled if a non-NIL value for :FILL-POINTER is supplied and<P>
|
||
|
the array to be adjusted does not already have a fill pointer.<P>
|
||
|
<P>
|
||
|
<B>Test Case:<P>
|
||
|
</B><P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> A1 (<A REL=DEFINITION HREF="../Body/f_mk_ar.htm#make-array"><B>MAKE-ARRAY</B></A> 5 :FILL-POINTER 3 :ADJUSTABLE T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> A2 (<A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> A1 4))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> A1) => 3<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> A2) => 3<P>
|
||
|
<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> B1 (<A REL=DEFINITION HREF="../Body/f_mk_ar.htm#make-array"><B>MAKE-ARRAY</B></A> 5 :FILL-POINTER 3 :ADJUSTABLE T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> B2 (<A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> B1 2 :FILL-POINTER 1))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> B1) => 1<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> B2) => 1<P>
|
||
|
<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> C1 (<A REL=DEFINITION HREF="../Body/f_mk_ar.htm#make-array"><B>MAKE-ARRAY</B></A> 5 :FILL-POINTER 3 :ADJUSTABLE T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> C2 (<A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> C1 2 :FILL-POINTER T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> C1) => 2<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> C2) => 2<P>
|
||
|
<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> D1 (<A REL=DEFINITION HREF="../Body/f_mk_ar.htm#make-array"><B>MAKE-ARRAY</B></A> 5 :ADJUSTABLE T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> D2 (<A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> D1 2 :FILL-POINTER 2)) signals an error.<P>
|
||
|
<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> E1 (<A REL=DEFINITION HREF="../Body/f_mk_ar.htm#make-array"><B>MAKE-ARRAY</B></A> 5 :FILL-POINTER T :ADJUSTABLE T))<P>
|
||
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> E2 (<A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> E1 4)) is an error.<P>
|
||
|
<P>
|
||
|
<B>Rationale:<P>
|
||
|
</B><P>
|
||
|
This behavior must be more clearly defined if portable programs are going<P>
|
||
|
to be able to depend on it.<P>
|
||
|
<P>
|
||
|
<B>Current Practice:<P>
|
||
|
</B><P>
|
||
|
Symbolics Lisp implements the proposal. In case "E", it does not signal an<P>
|
||
|
error. It simply leaves the illegal <A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>fill-pointer</B></A> in place so that the<P>
|
||
|
programmer can correct it using (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_fill_p.htm#fill-pointer"><B>FILL-POINTER</B></A> E2) ...)<P>
|
||
|
<P>
|
||
|
<B>Cost to Implementors:<P>
|
||
|
</B><P>
|
||
|
Probably most implementations do not deviate significantly from the proposed<P>
|
||
|
behavior. The cost to implementors is probably very slight.<P>
|
||
|
<P>
|
||
|
<B>Cost to Users:<P>
|
||
|
</B><P>
|
||
|
None. This clarifies a fuzzy area in the manual which users cannot currently<P>
|
||
|
depend upon.<P>
|
||
|
<P>
|
||
|
<B>Cost of Non-Adoption:<P>
|
||
|
</B><P>
|
||
|
The interaction between <A REL=DEFINITION HREF="../Body/f_adjust.htm#adjust-array"><B>ADJUST-ARRAY</B></A> and fill-pointers would continue to be<P>
|
||
|
hazy, and portable programs would not be able to rely upon that behavior<P>
|
||
|
being consistent across implementations.<P>
|
||
|
<P>
|
||
|
<B>Benefits:<P>
|
||
|
</B><P>
|
||
|
The cost of non-adoption would be avoided.<P>
|
||
|
<P>
|
||
|
<B>Aesthetics:<P>
|
||
|
</B><P>
|
||
|
There is little if any aesthetic impact of this change.<P>
|
||
|
<P>
|
||
|
<B>Discussion:<P>
|
||
|
</B><P>
|
||
|
Pitman volunteered to write this issue up for the Cleanup committee. He's<P>
|
||
|
not very passionate about the details one way or another, but figures it's<P>
|
||
|
a good idea that they be clarified.<P>
|
||
|
<P>
|
||
|
<P>
|
||
|
The cleanup committee didn't object.<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>
|