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]!
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]!
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]!
Tobias Pape uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-topa.215.mcz
==================== Summary ====================
Name: CollectionsTests-topa.215
Author: topa
Time: 25 March 2014, 2:27:43.108 pm
UUID: cb44512a-51f4-4cef-8d33-336b520e113f
Ancestors: CollectionsTests-dtl.214
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.
=============== Diff against CollectionsTests-dtl.214 ===============
Item was added:
+ ----- Method: WriteStreamTest>>testStreamAlwasyUseGivenCollection (in category 'tests - instance creation') -----
+ testStreamAlwasyUseGivenCollection
+ "self debug: #testStreamUseGivenCollection"
+
+ "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."
+
+ |string stream|
+
+ string := String withAll: 'xy'.
+ stream := WriteStream on: string.
+
+ stream nextPut: $a.
+ stream nextPut: (Character codePoint: 269). "wide."
+ self assert: string = (String with: $a with: (Character codePoint: 269)).!
Tobias Pape uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-topa.215.mcz
==================== Summary ====================
Name: CollectionsTests-topa.215
Author: topa
Time: 25 March 2014, 2:27:43.108 pm
UUID: cb44512a-51f4-4cef-8d33-336b520e113f
Ancestors: CollectionsTests-dtl.214
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.
=============== Diff against CollectionsTests-dtl.214 ===============
Item was added:
+ ----- Method: WriteStreamTest>>testStreamAlwasyUseGivenCollection (in category 'tests - instance creation') -----
+ testStreamAlwasyUseGivenCollection
+ "self debug: #testStreamUseGivenCollection"
+
+ "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."
+
+ |string stream|
+
+ string := String withAll: 'xy'.
+ stream := WriteStream on: string.
+
+ stream nextPut: $a.
+ stream nextPut: (Character codePoint: 269). "wide."
+ self assert: string = (String with: $a with: (Character codePoint: 269)).!
Tobias Pape uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-topa.215.mcz
==================== Summary ====================
Name: CollectionsTests-topa.215
Author: topa
Time: 25 March 2014, 2:27:43.108 pm
UUID: cb44512a-51f4-4cef-8d33-336b520e113f
Ancestors: CollectionsTests-dtl.214
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.
=============== Diff against CollectionsTests-dtl.214 ===============
Item was added:
+ ----- Method: WriteStreamTest>>testStreamAlwasyUseGivenCollection (in category 'tests - instance creation') -----
+ testStreamAlwasyUseGivenCollection
+ "self debug: #testStreamUseGivenCollection"
+
+ "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."
+
+ |string stream|
+
+ string := String withAll: 'xy'.
+ stream := WriteStream on: string.
+
+ stream nextPut: $a.
+ stream nextPut: (Character codePoint: 269). "wide."
+ self assert: string = (String with: $a with: (Character codePoint: 269)).!