<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">We spent a long time trying to find good names (and not just for these methods).  As I recall, we rejected #copyEmpty because we felt that the programmer might reasonably expect the result of #copyEmpty to be empty, and, with Array for example,  it isn't going to be.<div><br class="webkit-block-placeholder"></div><div>Hence the more descriptive names.   They are mostly used internally, where the extra length is no handicap.  On  the occasions when they are used externally, the extra length is  a benefit.</div><div><br class="webkit-block-placeholder"></div><div><br><div><div>On 23 Feb 2008, at 0:07, Paolo Bonzini wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite"><p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Helvetica" size="4" style="font: 14.0px Helvetica"><span class="Apple-converted-space"> </span>We decided to uniformly use two methods, emptyCopyOfSize: and emptyCopyOfSameSize , to generate the new collections.<span class="Apple-converted-space">  </span>emptyCopyOfSameSize was implemented as</font></p> <p style="margin: 0.0px 0.0px 0.0px 10.0px"><font face="Helvetica" size="4" style="font: 14.0px Helvetica"><span class="Apple-converted-space">    </span>^ self<span class="Apple-converted-space">  </span>emptyCopyOfSize: self size</font></p> </blockquote><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="4" style="font: 14.0px Helvetica">This is what other Smalltalk usually call #copyEmpty and #copyEmpty:.</font></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px"><br></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="4" style="font: 14.0px Helvetica">As I said, it works for everything except #reverse and #collect: for which you can either use something like #copyEmptyForCollect, or resort to #species.</font></p> </blockquote><br></div><div>Why doesn't this work for #reversed? </div><div><br class="webkit-block-placeholder"></div><div>For collect, I agree, the new collection may not be of the same class, and thus should not be called a copy; #emptyCollectionForCollect:  or #emptyForCollect: would seem to be suggestive names.</div><div><br class="webkit-block-placeholder"></div><div>Shouldn't #reverse (the imperative form of the verb) be a mutator?   But I guess that's another issue</div><br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="font-size: 12px; "><span class="Apple-style-span" style="font-size: 12px; ">Professor Andrew P. Black</span></div><div style="font-size: 12px; "><span class="Apple-style-span" style="font-size: 12px; ">Department of Computer Science</span></div><div style="font-size: 12px; "><span class="Apple-style-span" style="font-size: 12px; ">Portland State University</span></div><div style="font-size: 12px; "><span class="Apple-style-span" style="font-size: 12px; ">+1 503 725 2411</span></div><div style="font-size: 12px; "><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span> </div><br></div></body></html>