Eso es, Guille!! that was the problem, both arrays should be of the same type/format, I tried the method calling a replaceFrom: 1 to: 2 with: #(1 2 3) startingAt: 1. so I was passing an Array object instead, so I'm doing the right thing but wrong testing! Thanks a lot! I'm not on Discord but I could activate an account if it is more comfortable to you...
El mié., 10 jun. 2020 a las 10:46, Guillermo Polito (< guillermopol...@gmail.com>) escribió: > Hi Jesus, > > We have looked at it with Pablo. We were wondering too if you could give > us a reproducible case for what is not working with you, because we have > tested it and it seems to be working (details below). > > The array replace primitive is a generic primitive that handles the > replace of arrays of objects and arrays of native values (8, 16, 32, 64bit > values). > Now, for the primitive to work, both arrays should be of the same > type/format. > > “All these examples do use the primitive" > a := WordArray withAll: #( 1 2 3 4 ). > b := WordArray withAll: #( 5 6 ). > > a replaceFrom: 1 to: 2 with: b startingAt: 1. > > a := DoubleWordArray withAll: #( 1 2 3 4 ). > b := DoubleWordArray withAll: #( 5 6 ). > > a replaceFrom: 1 to: 2 with: b startingAt: 1. > > “All these examples do not use the primitive" > a := DoubleWordArray withAll: #( 1 2 3 4 ). > b := ByteArray withAll: #( 5 6 ). > > a replaceFrom: 1 to: 2 with: b startingAt: 1. > > a := DoubleWordArray withAll: #( 1 2 3 4 ). > b := Array withAll: #( 5 6 ). > > a replaceFrom: 1 to: 2 with: b startingAt: 1. > > If you tell us a bit more we could probably be of more help. > Also, we were looking for you in discord to ask you questions, are you > there? > Guille > > El 9 jun 2020, a las 21:31, Jesus Mari Aguirre <jmariagui...@gmail.com> > escribió: > > Thanks for your response > I've tried in WordArray and ByteArray and same behaviour, primitive 105 > fails and executes the code after the primitive call. > It is Pharo 8.0 64 on Mac Os X...I will try on Ubuntu 19.4...as soon as I > can. > the same problem in all of the Collection-Native all of them use primitive > 105 > > <Captura de pantalla 2020-06-09 a las 21.20.43.png> > > El mar., 9 jun. 2020 a las 18:34, Stéphane Ducasse (< > stephane.duca...@inria.fr>) escribió: > >> Hello >> >> I am developing a "numpy arrays" like framework on pharo, >> >> >> Cool >> >> I decided to use an Array type depending on the class of its elements (I >> thought it would be more efficient) i.e if the array contains floats it >> will be stored in a floatArray but if contains integers, a IntegerArray >> will be used. >> >> >> Did you check the WordArray class and friend? >> >> >> I make an extensive use of use of the method replaceFrom: start to: stop >> with: replacement startingAt: repStart when I do concat and other >> methods that imply copying but I've realize that primitive 105 is not >> executes when I call this method from these kind of arrays but it works if >> I use a normal Array. >> What do you suggest me to do? is it better to use the normal Array for >> every type of content or is it a bugg? Is FloatArray/IntegerArray more >> efficient in any way? If not...what is their purpose? >> >> >> I read the code and I do not understand why this primitives have all the >> same number. >> May be this is normal. I will ask around. >> >> >> replaceFrom: start to: stop with: replacement startingAt: repStart >> "Primitive. This destructively replaces elements from start to stop in >> the receiver starting at index, repStart, in the collection, replacement. >> Answer the receiver. Range checks are performed in the primitive only. >> Optional. See Object documentation whatIsAPrimitive." >> <primitive: 105> >> super replaceFrom: start to: stop with: replacement startingAt: repStart >> >> >> S. >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr / http://www.pharo.org >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> >> >