bugs in (Sequence traits) atAllPut: and atAll:put:

Tim Olson tim at io.com
Thu Nov 11 17:44:40 PST 2004


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
].

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
].

	-- Tim Olson




More information about the Slate mailing list