[squeak-dev] ByteArray>>at:put:

Bert Freudenberg bert at freudenbergs.de
Tue Jul 25 11:27:53 UTC 2017


On Thu, Jul 20, 2017 at 12:46 PM, Bert Freudenberg <bert at 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:
> http://source.squeak.org/inbox/Collections-bf.761.diff
>

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 -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170725/25539937/attachment.html>


More information about the Squeak-dev mailing list