[squeak-dev] The Trunk: Collections-topa.565.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Mar 25 20:07:31 UTC 2014


OK, I see this works anyway because ByteString>>at:put: will handle the
case and use becomeForward:

But should we rely on this expectation? It comes from a Smalltalk where
become: were cheap.
For example, WriteStream>>pastEndPut: does not preserve collection identity


2014-03-25 14:28 GMT+01:00 <commits at source.squeak.org>:

> Tobias Pape uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-topa.565.mcz
>
> ==================== Summary ====================
>
> Name: Collections-topa.565
> Author: topa
> Time: 25 March 2014, 2:28:36.459 pm
> UUID: b7c264b3-1e69-494d-8979-6f71bc9b846d
> Ancestors: Collections-ul.564
>
> When a stream is created on a collection, it tries to keep
> using that collection instead of copying, even in the case
> of mutation of the original collection.
>
> The code removed prevented this.
>
> =============== Diff against Collections-ul.564 ===============
>
> Item was changed:
>   ----- Method: WriteStream>>nextPut: (in category 'accessing') -----
>   nextPut: anObject
>         "Primitive. Insert the argument at the next position in the Stream
>         represented by the receiver. Fail if the collection of this stream
> is not an
>         Array or a String. Fail if the stream is positioned at its end, or
> if the
>         position is out of bounds in the collection. Fail if the argument
> is not
>         of the right type for the collection. Optional. See Object
> documentation
>         whatIsAPrimitive."
>
>         <primitive: 66>
> -       ((collection class == ByteString) and: [
> -               anObject isCharacter and:[anObject isOctetCharacter not]])
> ifTrue: [
> -                       collection := (WideString from: collection).
> -                       ^self nextPut: anObject.
> -       ].
>         position >= writeLimit
>                 ifTrue: [^ self pastEndPut: anObject]
>                 ifFalse:
>                         [position := position + 1.
>                         ^collection at: position put: anObject]!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140325/97c8e8ca/attachment.htm


More information about the Squeak-dev mailing list