<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-09-23 21:20 GMT+02:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2014-09-22 23:16 GMT+02:00 Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><div>On 22.09.2014, at 22:47, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-09-22 22:34 GMT+02:00 Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
On 22.09.2014, at 22:21, Ron Teitelbaum <<a href="mailto:ron@usmedrec.com" target="_blank">ron@usmedrec.com</a>> wrote:<br>
<br>
><br>
>> From: Bert Freudenberg<br>
>> Sent: Monday, September 22, 2014 4:00 PM<br>
>><br>
>> I just found out why PNG decoding was broken in SqueakJS [*]. Wouldn't<br>
>> have believed that any code actually relied on the following behavior:<br>
>><br>
>> | a |<br>
>> a := (1 to: 20) asArray.<br>
>> a replaceFrom: 11 to: 20 with: a startingAt: 8.<br>
>><br>
>> ==> #(1 2 3 4 5 6 7 8 9 10 8 9 10 8 9 10 8 9 10 8)<br>
>><br>
> That's funky! Hope it wasn't my code! Seems wrong to not copy the array<br>
> before modifying it (Like your buggy VM did).<br>
<br>
</span>It's not a copy. It moved the numbers 8-17 to index 11. Which is what I erroneously had assumed to be the desired behavior.<br>
<span><font color="#888888"><br>
- Bert -<br>
</font></span><div><div><br></div></div></blockquote><div><br></div><div>It's a known problem.<br></div><div>The primitive should use memmove rather than memcpy.<br></div><div>So the solution is quite simple, it's just that it's waiting for a good soul to integrate it.<br></div></div></div></div></blockquote><div><br></div></span><div>What I'm saying is that there is code which will actually fail in subtle ways if we change that behavior. The LZW decode *relies* on this. If we change the primitive it would fail.</div><div><br></div></div></div></blockquote><div><br></div></span><div>Ah, oh !<br></div><div>I missread your post!<br></div><div>Relying on an undefined behavior is not a clever thing...<br></div><div>OK, since we never changed the implementation, it's a stable behavior... but it is for sure unspecified.<br></div><div>There is no limit to the hackish nature of some Squeak code, really...<br></div><div>Hang it in the hall of shame.<br></div><span class=""><div><br></div></span></div></div></div></blockquote><div><br></div><div>Is it decompressBlock:with: ?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div></div><div>So rather than changing what the "stringReplace" primitive does we might rather want to add a "stringMove" primitive.</div><div><br></div><div>Btw, BitBlt has "move" semantics and I believe this is even used in some places (via #hackBits:).</div><span><font color="#888888"><div><br></div><div><span style="font-size:12px">- Bert -</span></div></font></span><span><div><span style="font-size:12px"></span> <br></div></span></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><span><div><span style="font-size:12px"></span></div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>
> Ron<br>
><br>
>> In my (buggy) VM it answered<br>
>><br>
>> ==> #(1 2 3 4 5 6 7 8 9 10 8 9 10 11 12 13 14 15 16 17)<br>
>><br>
>> which apparently did not at all match what The Creators intended ;)<br>
>><br>
>> - Bert -<br>
>><br>
>> [*] specifically, #decompressBlock:with:<br>
><br>
><br>
<br>
<br>
</div></div><br><br>
<br></blockquote></div><br></div></div>
<br></blockquote></span></div><div><span style="border-collapse:separate;border-spacing:0px;font-family:"Lucida Grande";font-size:12px"><div style="word-wrap:break-word"><br></div></span><br>
</div>
<br></div><br><br>
<br></blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>