In an earlier post it was noted that WriteStream does not support having its <br>collection instance variable being an instance of OrderedCollection; <br>the Problem being that OrderedCollection does not support:<br><br> #at:index put: object
<br><br>where the index is beyond the lastIndex instance variable <br>of the orderedCollection object.<br><br>I suggest that if the value of index is one beyond the value of lastIndex then<br>the orderCollection object do an add operation and otherwise behave as before.
<br><br>This would fix the problem with WriteStream <br>but I suppose this violates some principle somewhere.<br><br>For me the complaint is that now you have the WriteStream instance<br>managing the size of its collection and if its collection is an instance of
<br>OrderedCollection the collection is also managing its own size.<br><br>For the record:<br>What are the reasons that WriteStream was not designed<br>to use OrderedCollection as the class of its <br>(then internally instanciated and private) collection instance variable anyway?
<br>This would have made the implementation of WriteStream MUCH simpler.<br><br>One could argue that this would prevent the collection being some kind of growable<br>linked list structure. But since WriteStream already does a complete copy every
<br>time it decides the collection is too small this doesn't seem very important to me.<br><br>Of course, since the user passes the initial collection to the WriteStream object,<br>he also has access to the collection which he would then lose.
<br>But it is not clear to me why the user should have direct access to the collection at all. <br>Of course, for PositionalStream objects, the user would still need <br>to pass in a collection object but WriteStream could override this behavior.
<br><br>The biggest problem I see with modifying WriteStream to work this way is<br>
that currently the user determines the class of the object returned by the <br>
contents method of WriteStream. With this change the class of the object <br>
returned would be decided by WriteStream.<br>
<br>If WriteStream were modified to work this way would anything in Squeak break?<br>Of course somewhere some squeak user would get burned but since I think<br>such users have written BAD code I am not too sympathetic.<br>
<br>Reasons why the whole idea is just plain bad are perfectly welcome.<br>(And who's going to stop you from pointing them out anyway.)<br><br><br>Ralph Boland<br><br><br><br>