Re: [Pharo-users] Array : very weird behavior

2015-11-19 Thread Marcus Denker
Hello, You are changing the “literal array” itself. The #(0 0 0 0) creates an array as part of the compiledMethod and you are changing this. (Yes, many people think that all literals should be immutable…). If you add a #copy it will work. bitArray1 := #(0 0 0 0) copy or create the arr

[Pharo-users] Array : very weird behavior

2015-11-19 Thread abdelghani ALIDRA
Hi everybody, I am experiencing a very weird behavior with Arrays : I writed a test case as follows ; testChange | bitArray1 | bitArray1 := #(0 0 0 0). (1 to: bitArray1 size) do: [ :index ||temp| temp := (bitArray1 at: index) + 1. bitArray1 at: index put: (temp). ]. self assert: bitArray1 = #(