Re: [Pharo-users] Destructive copy in #replaceFrom:to:with:startingAt:

2019-08-09 Thread Richard O'Keefe
The ANSI Smalltalk standard is characteristically vague here. Both the memmove and memcpy readings are consistent with it. The standard is characteristically buggy here too: the two lines I've flagged with ** disagree. I take the second one to be correct. 5.7.12.5 Message: replaceFrom: start t

[Pharo-users] Destructive copy in #replaceFrom:to:with:startingAt:

2019-08-08 Thread James Foster
After many hours of debugging I’ve finally discovered that Pharo’s implementation of #replaceFrom:to:with:startingAt: does not make any check for overlapping regions to avoid destructive operations. | bytes | bytes := #(1 2 3 4 5 6 7 8) copy. bytes replaceFrom: 4 to: 7 with: bytes startingAt: 1