Would be good to have tests showing the problem. Did you check if such method is not already covered (even by a bad test)?
Stef On Sun, Dec 31, 2017 at 2:47 PM, Andy Burnett <andy.burn...@knowinnovation.com> wrote: > Ben wrote >>> > > > Its not so much that your first example sorted the permutations, but that > the collection contained only one permutation. > I've swapped the order of your examples and downsized them to the simplest > case to observe. > Something seems broken. It works as expected if the "copy" is uncommented. > > Transcript clear. > oc1 := OrderedCollection new. > oc2 := OrderedCollection new. > Transcript crShow:'a---'. > (1 to: 3) permutationsDo: [ :each | Transcript crShow: each. oc1 add: > each asOrderedCollection]. > Transcript crShow:'b---'. > (1 to: 3) permutationsDo: [ :each | Transcript crShow: each. oc2 add: > each "copy"]. > Transcript crShow:'c---'. > Transcript crShow: { oc1 asSet size. oc2 asSet size}. > Transcript crShow:'d---'. > oc2 do: [ :x | Transcript crShow: x ]. > > ==> > a--- > #(1 2 3) > #(1 3 2) > #(2 1 3) > #(2 3 1) > #(3 2 1) > #(3 1 2) > b--- > #(1 2 3) > #(1 3 2) > #(2 1 3) > #(2 3 1) > #(3 2 1) > #(3 1 2) > c--- > #(6 1) > d--- > #(1 2 3) > #(1 2 3) > #(1 2 3) > #(1 2 3) > #(1 2 3) > #(1 2 3) > > cheers -ben > > <<< > > Thanks Ben, > That is really interesting. I had completely misunderstood the problem. > Checking the items in oc2 shows that they are literally the same object. So, > it would seem that I have to run copy, or some other method to get a unique > object. > > I can see that this would make sense from an efficiency perspective. Reusing > the same object would presumably save memory space. However, it would > probably be good to update the comment to let people know that this will > happen. > > What is the process for submitting suggested improvements to class comments? > > Cheers > Andy