[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] ArrayCollection:addAll



The "redundancy" is a fallback position in case the primitive fails.

If the primitive is successful, the method returns after _ArrayAddAll and does not execute the rest of the method. If it fails, something has to handle it. Integer:+ is a good example.

I don't think this should be changed. There might be some cases where the fallback is necessary and people's code would magically stop working.

e.g.:

a = [];
a.addAll((a: 1, b: 2));

Now comment out the fallback and do the same thing. Oops.

hjh

On Dec 13, 2007, at 6:42 AM, ronald kuivila wrote:

Hi,

  In ArrayedCollection, the method definition of addAll uses a primitive and then does it itself,
just to make sure.  

  Commenting out the redundancy works fine.  If no objections, I will commit tonight.

   addAll { arg aCollection; 
var array;
_ArrayAddAll
array = this;
aCollection.asCollection.do({ arg item; array = array.add(item) }) ;
^array
}


RJK


: H. James Harkins

: jamshark70@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman