<div dir="ltr"><div>In VA Smalltalk</div>
<div>&nbsp;</div>
<div>&nbsp; (WriteStream on: String new) nextPutAll: &#39;abc&#39;; skip: -1;<br>&nbsp; &nbsp; contents</div>
<div>&nbsp;</div>
<div>also answers &#39;ab&#39;.</div>
<div><br clear="all">John O&#39;Keefe [|], Principal Smalltalk Architect, Instantiations Inc.<br><br><br></div>
<div class="gmail_quote">On Thu, Oct 16, 2008 at 10:04 PM, Richard O&#39;Keefe <span dir="ltr">&lt;<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><br>On 16 Oct 2008, at 8:14 pm, Paolo Bonzini wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">In the standard, the definition of #contents for &lt;WriteStream&gt; comes<br>from &lt;collectionStream&gt; so that this:<br>
<br>&nbsp;(WriteStream on: String new) nextPutAll: &#39;abc&#39;; skip: -1;<br>&nbsp; &nbsp; contents<br><br>should &quot;return a collection that contains the receiver&#39;s past and future<br>sequence values, in order&quot;, i.e. &#39;abc&#39;. &nbsp;To me it makes more sense that<br>
it returns &#39;ab&#39;.<br></blockquote><br></div>In Squeak and VisualWorks the answer is indeed &#39;ab&#39;,<br>which I find rather counterintuitive. &nbsp;The $c is,<br>after all, still part of the contents, and skip: 1<br>
will reveal it.<br><br>In implementation terms, it&#39;s the difference between<br><br>&nbsp; &nbsp; &nbsp; &nbsp;^collection copyFrom: 1 to: position<br><br>and<br><br>&nbsp; &nbsp; &nbsp; &nbsp;^collection copyFrom: 1 to: readLimit<br><br>My library, written to the standard, does the latter;<br>
Squeak and VisualWorks do the former.<br><br>The meaning of #contents in the standard is<br>&quot;a collection containing the complete contents of the stream&quot;.<br><br>If you do<br>&nbsp; &nbsp; &nbsp; &nbsp;(ReadStream on: &#39;abc&#39;) skip: 2; contents<br>
you get all the characters, not just the remaining ones.<br><br>Nasty one: the standard&#39;s definition is simple, sensible,<br>and easy to implement (except for file streams, of course,<br>(:-)). &nbsp;But implementations do something else.<br>
<br>What do other Smalltalks than Squeak and VW do? 
<div>
<div></div>
<div class="Wj3C7c"><br><br><br><br>_______________________________________________<br>ANSI-Smalltalk mailing list<br><a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br></div></div></blockquote></div><br></div>