[squeak-dev] roassal3 at:put "why"
gettimothy
gettimothy at zoho.com
Sat Oct 24 12:34:11 UTC 2020
Hi folks.
Here is the "why" of the failure....
OrderedCollection >> at: anInteger put: anObject
"Put anObject at element index anInteger. at:put: cannot be used to
append, front or back, to an ordered collection; it is used by a
knowledgeable client to replace an element."
| index |
1 <= anInteger ifFalse: [ self errorNoSuchElement ].
(index := anInteger + firstIndex - 1) <= lastIndex ifFalse: [ self errorNoSuchElement ].
^array at: index put: anObject
At this point, the size of the collection is zero.
I will see if I can finagle this at the OC creation...
x := self species
new: 0
streamContents: [ :stream | self do: [ :each |
i := i +1.
stream nextPutAll: (aBlock value: each).
self break.
]].
That '0' is probably the problem.
cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201024/83f0eb2e/attachment.html>
More information about the Squeak-dev
mailing list
|