[ANSI-Smalltalk] #contents on <collectionStream> (was: #contents on WriteStream)

Richard O'Keefe ok at cs.otago.ac.nz
Mon Oct 20 03:24:20 BST 2008


On 18 Oct 2008, at 6:36 pm, cstb wrote:
>
> It would be nice if the standard was
> for <collectionStream> to provide both
>
>        contents        ->      upTo: readLimit
> and
>        currentContents ->      upTo: position

Agreed.  That still leaves us with the problem that
at least VA, VW, and Squeak don't conform to the
standard's definition of #contents.

It would also be nice if ReadStream, ReadWriteStream,
and WriteStream were consistent, and the only consistent
specification around is the one in the standard.

But if major implementations haven't caught up with the
1998 standard yet, then maybe they won't ever.

It might be more politically practical to get
	pastContents = 1..position
	futureContents = position+1..end
	fullContents = pastContents , futureContents
and leave #contents imlementation-defined.
Perhaps we can get agreement to some additions
where 10 years have not sufficed to get a change.

Here's the code I've just added to my library.
I've attached a Squeak changeset.

ReadStream
   methods:
     pastContents
       "Answer the ANSI 'past sequence values' of the receiver."
       ^collection copyFrom: 1 to: position
     futureContents
       "Answer the ANSI 'future sequence values' of the receiver."
       ^collection copyFrom: position + 1 to: readLimit
     fullContents
       "Answer the ANSI contents of the receiver."
       ^collection copyFrom: 1 to: readLimit

WriteStream
   methods:
     pastContents
       "Answer the ANSI 'past sequence values' of the receiver."
       ^collection copyFrom: 1 to: position
     futureContents
       "Answer the ANSI 'future sequence values' of the receiver."
       self pvtSetTidemark.
       ^collection copyFrom: position + 1 to: tidemark
     fullContents
       "Answer the ANSI contents of the receiver."
       self pvtSetTidemark.
       ^collection copyFrom: 1 to: tidemark

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MoreContents.1.cs
Type: application/octet-stream
Size: 1810 bytes
Desc: not available
Url : http://lists.openskills.org/pipermail/ansi-smalltalk/attachments/20081020/4c26fd6f/MoreContents.1.obj
-------------- next part --------------





More information about the ANSI-Smalltalk mailing list