Browse Source

Small SequenceableCollection refactoring:

- Only sequenceable collections can be streamed
- Moved some methods to SequenceableCollection
Nicolas Petton 11 years ago
parent
commit
583479193c
3 changed files with 308 additions and 234 deletions
  1. 109 85
      js/Kernel-Collections.deploy.js
  2. 152 118
      js/Kernel-Collections.js
  3. 47 31
      st/Kernel-Collections.st

+ 109 - 85
js/Kernel-Collections.deploy.js

@@ -481,19 +481,6 @@ return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smallt
 messageSends: ["do:", "putOn:"]}),
 smalltalk.Collection);
 
-smalltalk.addMethod(
-"_readStream",
-smalltalk.method({
-selector: "readStream",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(self)._stream();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.Collection)})},
-messageSends: ["stream"]}),
-smalltalk.Collection);
-
 smalltalk.addMethod(
 "_reject_",
 smalltalk.method({
@@ -567,45 +554,6 @@ return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})
 messageSends: ["subclassResponsibility"]}),
 smalltalk.Collection);
 
-smalltalk.addMethod(
-"_stream",
-smalltalk.method({
-selector: "stream",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self)._streamClass())._on_(self);
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.Collection)})},
-messageSends: ["on:", "streamClass"]}),
-smalltalk.Collection);
-
-smalltalk.addMethod(
-"_streamClass",
-smalltalk.method({
-selector: "streamClass",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self)._class())._streamClass();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.Collection)})},
-messageSends: ["streamClass", "class"]}),
-smalltalk.Collection);
-
-smalltalk.addMethod(
-"_writeStream",
-smalltalk.method({
-selector: "writeStream",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(self)._stream();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.Collection)})},
-messageSends: ["stream"]}),
-smalltalk.Collection);
-
 
 smalltalk.addMethod(
 "_new_",
@@ -620,19 +568,6 @@ return $1;
 messageSends: ["new"]}),
 smalltalk.Collection.klass);
 
-smalltalk.addMethod(
-"_streamClass",
-smalltalk.method({
-selector: "streamClass",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=(smalltalk.Stream || Stream);
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.Collection.klass)})},
-messageSends: []}),
-smalltalk.Collection.klass);
-
 smalltalk.addMethod(
 "_with_",
 smalltalk.method({
@@ -1288,11 +1223,9 @@ smalltalk.method({
 selector: "withIndexDo:",
 fn: function (aBlock){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(self)._keysAndValuesDo_((function(key,value){
-return smalltalk.withContext(function($ctx2) {
return _st(aBlock)._value_value_(value,key);
-}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
+return smalltalk.withContext(function($ctx1) { 
_st(self)._keysAndValuesDo_(aBlock);
 return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
-messageSends: ["keysAndValuesDo:", "value:value:"]}),
+messageSends: ["keysAndValuesDo:"]}),
 smalltalk.HashedCollection);
 
 
@@ -1787,6 +1720,32 @@ return $1;
 messageSends: ["at:", "size"]}),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_newStream",
+smalltalk.method({
+selector: "newStream",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._streamClass())._on_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
+messageSends: ["on:", "streamClass"]}),
+smalltalk.SequenceableCollection);
+
+smalltalk.addMethod(
+"_readStream",
+smalltalk.method({
+selector: "readStream",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
+messageSends: ["stream"]}),
+smalltalk.SequenceableCollection);
+
 smalltalk.addMethod(
 "_removeLast",
 smalltalk.method({
@@ -1840,6 +1799,32 @@ return $1;
 messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"]}),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_stream",
+smalltalk.method({
+selector: "stream",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._newStream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
+messageSends: ["newStream"]}),
+smalltalk.SequenceableCollection);
+
+smalltalk.addMethod(
+"_streamClass",
+smalltalk.method({
+selector: "streamClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._class())._streamClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
+messageSends: ["streamClass", "class"]}),
+smalltalk.SequenceableCollection);
+
 smalltalk.addMethod(
 "_third",
 smalltalk.method({
@@ -1875,6 +1860,48 @@ return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},sm
 messageSends: []}),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_writeStream",
+smalltalk.method({
+selector: "writeStream",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
+messageSends: ["stream"]}),
+smalltalk.SequenceableCollection);
+
+
+smalltalk.addMethod(
+"_streamClass",
+smalltalk.method({
+selector: "streamClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=(smalltalk.Stream || Stream);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
+messageSends: []}),
+smalltalk.SequenceableCollection.klass);
+
+smalltalk.addMethod(
+"_streamContents_",
+smalltalk.method({
+selector: "streamContents:",
+fn: function (aBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+stream=_st(_st(self)._streamClass())._on_(_st(self)._new());
+_st(aBlock)._value_(stream);
+$1=_st(stream)._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
+messageSends: ["on:", "new", "streamClass", "value:", "contents"]}),
+smalltalk.SequenceableCollection.klass);
 
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
@@ -3089,22 +3116,6 @@ return $1;
 messageSends: []}),
 smalltalk.String.klass);
 
-smalltalk.addMethod(
-"_streamContents_",
-smalltalk.method({
-selector: "streamContents:",
-fn: function (blockWithArg){
-var self=this;
-var stream;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
-_st(blockWithArg)._value_(stream);
-$1=_st(stream)._contents();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream},smalltalk.String.klass)})},
-messageSends: ["on:", "new", "streamClass", "value:", "contents"]}),
-smalltalk.String.klass);
-
 smalltalk.addMethod(
 "_tab",
 smalltalk.method({
@@ -3337,6 +3348,19 @@ return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.S
 messageSends: ["do:", "asString"]}),
 smalltalk.Symbol);
 
+smalltalk.addMethod(
+"_indexOf_",
+smalltalk.method({
+selector: "indexOf:",
+fn: function (anElement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._asString())._indexOf_(anElement);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:",{anElement:anElement},smalltalk.Symbol)})},
+messageSends: ["indexOf:", "asString"]}),
+smalltalk.Symbol);
+
 smalltalk.addMethod(
 "_isSymbol",
 smalltalk.method({

+ 152 - 118
js/Kernel-Collections.js

@@ -643,24 +643,6 @@ referencedClasses: []
 }),
 smalltalk.Collection);
 
-smalltalk.addMethod(
-"_readStream",
-smalltalk.method({
-selector: "readStream",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(self)._stream();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.Collection)})},
-args: [],
-source: "readStream\x0a\x09^self stream",
-messageSends: ["stream"],
-referencedClasses: []
-}),
-smalltalk.Collection);
-
 smalltalk.addMethod(
 "_reject_",
 smalltalk.method({
@@ -759,60 +741,6 @@ referencedClasses: []
 }),
 smalltalk.Collection);
 
-smalltalk.addMethod(
-"_stream",
-smalltalk.method({
-selector: "stream",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self)._streamClass())._on_(self);
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.Collection)})},
-args: [],
-source: "stream\x0a\x09^self streamClass on: self",
-messageSends: ["on:", "streamClass"],
-referencedClasses: []
-}),
-smalltalk.Collection);
-
-smalltalk.addMethod(
-"_streamClass",
-smalltalk.method({
-selector: "streamClass",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self)._class())._streamClass();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.Collection)})},
-args: [],
-source: "streamClass\x0a\x09^self class streamClass",
-messageSends: ["streamClass", "class"],
-referencedClasses: []
-}),
-smalltalk.Collection);
-
-smalltalk.addMethod(
-"_writeStream",
-smalltalk.method({
-selector: "writeStream",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(self)._stream();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.Collection)})},
-args: [],
-source: "writeStream\x0a\x09^self stream",
-messageSends: ["stream"],
-referencedClasses: []
-}),
-smalltalk.Collection);
-
 
 smalltalk.addMethod(
 "_new_",
@@ -832,24 +760,6 @@ referencedClasses: []
 }),
 smalltalk.Collection.klass);
 
-smalltalk.addMethod(
-"_streamClass",
-smalltalk.method({
-selector: "streamClass",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=(smalltalk.Stream || Stream);
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.Collection.klass)})},
-args: [],
-source: "streamClass\x0a\x09\x09^Stream",
-messageSends: [],
-referencedClasses: ["Stream"]
-}),
-smalltalk.Collection.klass);
-
 smalltalk.addMethod(
 "_with_",
 smalltalk.method({
@@ -1068,7 +978,7 @@ smalltalk.addMethod(
 "_with_do_",
 smalltalk.method({
 selector: "with:do:",
-category: 'enumeration',
+category: 'enumarating',
 fn: function (anotherCollection,aBlock){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
_st(self)._withIndexDo_((function(each,index){
@@ -1086,7 +996,7 @@ smalltalk.addMethod(
 "_withIndexDo_",
 smalltalk.method({
 selector: "withIndexDo:",
-category: 'enumeration',
+category: 'enumarating',
 fn: function (aBlock){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
_st(self)._subclassReponsibility();
@@ -1728,13 +1638,11 @@ selector: "withIndexDo:",
 category: 'enumerating',
 fn: function (aBlock){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
_st(self)._keysAndValuesDo_((function(key,value){
-return smalltalk.withContext(function($ctx2) {
return _st(aBlock)._value_value_(value,key);
-}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
+return smalltalk.withContext(function($ctx1) { 
_st(self)._keysAndValuesDo_(aBlock);
 return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
 args: ["aBlock"],
-source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
-messageSends: ["keysAndValuesDo:", "value:value:"],
+source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: aBlock",
+messageSends: ["keysAndValuesDo:"],
 referencedClasses: []
 }),
 smalltalk.HashedCollection);
@@ -2393,6 +2301,42 @@ referencedClasses: []
 }),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_newStream",
+smalltalk.method({
+selector: "newStream",
+category: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._streamClass())._on_(self);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
+args: [],
+source: "newStream\x0a\x09^self streamClass on: self",
+messageSends: ["on:", "streamClass"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection);
+
+smalltalk.addMethod(
+"_readStream",
+smalltalk.method({
+selector: "readStream",
+category: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
+args: [],
+source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
+messageSends: ["stream"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection);
+
 smalltalk.addMethod(
 "_removeLast",
 smalltalk.method({
@@ -2466,6 +2410,42 @@ referencedClasses: []
 }),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_stream",
+smalltalk.method({
+selector: "stream",
+category: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._newStream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
+args: [],
+source: "stream\x0a\x09^self newStream",
+messageSends: ["newStream"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection);
+
+smalltalk.addMethod(
+"_streamClass",
+smalltalk.method({
+selector: "streamClass",
+category: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._class())._streamClass();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
+args: [],
+source: "streamClass\x0a\x09^self class streamClass",
+messageSends: ["streamClass", "class"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection);
+
 smalltalk.addMethod(
 "_third",
 smalltalk.method({
@@ -2516,6 +2496,63 @@ referencedClasses: []
 }),
 smalltalk.SequenceableCollection);
 
+smalltalk.addMethod(
+"_writeStream",
+smalltalk.method({
+selector: "writeStream",
+category: 'streaming',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(self)._stream();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
+args: [],
+source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
+messageSends: ["stream"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection);
+
+
+smalltalk.addMethod(
+"_streamClass",
+smalltalk.method({
+selector: "streamClass",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=(smalltalk.Stream || Stream);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
+args: [],
+source: "streamClass\x0a\x09\x09^Stream",
+messageSends: [],
+referencedClasses: ["Stream"]
+}),
+smalltalk.SequenceableCollection.klass);
+
+smalltalk.addMethod(
+"_streamContents_",
+smalltalk.method({
+selector: "streamContents:",
+category: 'streaming',
+fn: function (aBlock){
+var self=this;
+var stream;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+stream=_st(_st(self)._streamClass())._on_(_st(self)._new());
+_st(aBlock)._value_(stream);
+$1=_st(stream)._contents();
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
+args: ["aBlock"],
+source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
+messageSends: ["on:", "new", "streamClass", "value:", "contents"],
+referencedClasses: []
+}),
+smalltalk.SequenceableCollection.klass);
 
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
@@ -4183,27 +4220,6 @@ referencedClasses: ["StringStream"]
 }),
 smalltalk.String.klass);
 
-smalltalk.addMethod(
-"_streamContents_",
-smalltalk.method({
-selector: "streamContents:",
-category: 'instance creation',
-fn: function (blockWithArg){
-var self=this;
-var stream;
-return smalltalk.withContext(function($ctx1) { 
var $1;
-stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
-_st(blockWithArg)._value_(stream);
-$1=_st(stream)._contents();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream},smalltalk.String.klass)})},
-args: ["blockWithArg"],
-source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
-messageSends: ["on:", "new", "streamClass", "value:", "contents"],
-referencedClasses: ["String"]
-}),
-smalltalk.String.klass);
-
 smalltalk.addMethod(
 "_tab",
 smalltalk.method({
@@ -4527,6 +4543,24 @@ referencedClasses: []
 }),
 smalltalk.Symbol);
 
+smalltalk.addMethod(
+"_indexOf_",
+smalltalk.method({
+selector: "indexOf:",
+category: 'accessing',
+fn: function (anElement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(_st(self)._asString())._indexOf_(anElement);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"indexOf:",{anElement:anElement},smalltalk.Symbol)})},
+args: ["anElement"],
+source: "indexOf: anElement\x0a\x09^ self asString indexOf: anElement",
+messageSends: ["indexOf:", "asString"],
+referencedClasses: []
+}),
+smalltalk.Symbol);
+
 smalltalk.addMethod(
 "_isSymbol",
 smalltalk.method({

+ 47 - 31
st/Kernel-Collections.st

@@ -69,24 +69,8 @@ occurrencesOf: anObject
 	^tally
 !
 
-readStream
-	^self stream
-!
-
 size
 	self subclassResponsibility
-!
-
-stream
-	^self streamClass on: self
-!
-
-streamClass
-	^self class streamClass
-!
-
-writeStream
-	^self stream
 ! !
 
 !Collection methodsFor: 'adding/removing'!
@@ -257,12 +241,6 @@ notEmpty
 	^self isEmpty not
 ! !
 
-!Collection class methodsFor: 'accessing'!
-
-streamClass
-		^Stream
-! !
-
 !Collection class methodsFor: 'instance creation'!
 
 new: anInteger
@@ -360,7 +338,7 @@ indexOf: anObject ifAbsent: aBlock
 	self subclassResponsibility
 ! !
 
-!IndexableCollection methodsFor: 'enumeration'!
+!IndexableCollection methodsFor: 'enumarating'!
 
 with: anotherCollection do: aBlock
 	"Calls aBlock with every value from self
@@ -562,7 +540,7 @@ valuesDo: aBlock
 !
 
 withIndexDo: aBlock
-	self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]
+	self keysAndValuesDo: aBlock
 ! !
 
 !HashedCollection methodsFor: 'printing'!
@@ -856,12 +834,53 @@ withIndexDo: aBlock
 	<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>
 ! !
 
+!SequenceableCollection methodsFor: 'streaming'!
+
+newStream
+	^self streamClass on: self
+!
+
+readStream
+	"For Pharo compatibility"
+	
+	^self stream
+!
+
+stream
+	^self newStream
+!
+
+streamClass
+	^self class streamClass
+!
+
+writeStream
+	"For Pharo compatibility"
+	
+	^self stream
+! !
+
 !SequenceableCollection methodsFor: 'testing'!
 
 includes: anObject
 	^(self indexOf: anObject ifAbsent: [nil]) notNil
 ! !
 
+!SequenceableCollection class methodsFor: 'accessing'!
+
+streamClass
+		^Stream
+! !
+
+!SequenceableCollection class methodsFor: 'streaming'!
+
+streamContents: aBlock
+	| stream |
+	stream := (self streamClass on: self new).
+	aBlock value: stream.
+	^ stream contents
+! !
+
 SequenceableCollection subclass: #Array
 	instanceVariableNames: ''
 	package: 'Kernel-Collections'!
@@ -1393,13 +1412,6 @@ fromString: aString
 		<return String(aString)>
 !
 
-streamContents: blockWithArg
-	|stream|
-	stream := (self streamClass on: String new).
-	blockWithArg value: stream.
-	^ stream contents
-!
-
 value: aUTFCharCode
 
 	<return String.fromCharCode(aUTFCharCode);>
@@ -1433,6 +1445,10 @@ at: anIndex ifAbsent: aBlock
 	^self asString at: anIndex ifAbsent: aBlock
 !
 
+indexOf: anElement
+	^ self asString indexOf: anElement
+!
+
 size
 	^self asString size
 ! !