On Thu, Jul 20, 2017 at 12:46 PM, Bert Freudenberg <bert@freudenbergs.de> wrote:
The problem is actually primitive 105, which allows this:

(ByteArray new: 10) replaceFrom: 1 to: 5 with: 'Hello'
=> #[72 101 108 108 111 0 0 0 0 0]

If you comment out the primitive call in ByteArray>>replaceFrom:to:with:startingAt: and also remove Tim's at:put:, it will fail. So if a VM does not implement the (optional) primitive 105, the fallback code is wrong.

Using #asInteger in ByteArray>>at:put: is a simple fix for that. Or we have to fix the fallback code in ByteArray>>replaceFrom:to:with:startingAt:.

I just committed the latter to the inbox but I'm not sure I like the implementation:

I take no response as silent ​agreement, so I moved this to trunk.
 
Also, ByteArray may not be the only class suffering from this problem:
SystemNavigation default browseAllSelect: [:cm | cm primitive = 105]

​Do we think these other places might need fixes?​
- Bert -