bugs in (Sequence traits) atAllPut: and atAll:put:
Brian Rice
water at tunes.org
Thu Nov 11 18:46:33 PST 2004
On Nov 11, 2004, at 5:44 PM, Tim Olson wrote:
> The code for atAllPut: declares a local variable "size" which is not
> initialized. It should use the size of the sequence parameter,
> instead:
>
> c@(Sequence traits) atAllPut: obj
> [
> 0 below: c size do: [| :index | c at: index put: obj].
> c
> ].
This method can't have been updated in a long time. I've committed:
c@(Sequence traits) atAllPut: obj
[
c infect: [| :_ | obj]
].
> Also, there are two methods for atAll:put: which only dispatch on the
> first parameter (the destination sequence). The first method is
> intended to place the same object (the third parameter) at all indices
> in a sequence, while the second is intended to place elements in a
> sequence at various indices. Because the second method isn't
> qualified on the third parameter, it overwrites the first. It should
> be changed to:
>
> c@(Sequence traits) atAll: indices@(Sequence traits) put:
> values@(Sequence traits)
> [
> indices with: values do: [| :index :value | c at: index put: value].
> values
> ].
Ah, good observation. I've committed that as well. Thanks!
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
More information about the Slate
mailing list