Hi Denis,

On Tue, Apr 4, 2017 at 9:53 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:

2017-04-04 18:45 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
still is not there, because is not the same primitive :)
look, this is the way where it is generated:��

translatedPrimitives
"an assorted list of various primitives"
(ByteString compiledMethodAt: #findSubstringViaPrimitive:in:startingAt:matchTable: ifAbsent: []) ifNotNil:
[^#("Pharo uses findSubstringViaPrimitive:in:startingAt:matchTable:"
(Bitmap compress:toByteArray:)
(Bitmap decompress:fromByteArray:at:)
(Bitmap encodeBytesOf:in:at:)
(Bitmap encodeInt:in:at:)
(ByteString compare:with:collated:)
(ByteString translate:from:to:table:)
(ByteString findFirstInString:inSet:startingAt:)
(ByteString indexOfAscii:inString:startingAt:)
(String findSubstringViaPrimitive:in:startingAt:matchTable:)
(ByteArray hashBytes:startingWith:)
(SampledSound convert8bitSignedFrom:to16Bit:))].
^#(
(Bitmap compress:toByteArray:)
(Bitmap decompress:fromByteArray:at:)
(Bitmap encodeBytesOf:in:at:)
(Bitmap encodeInt:in:at:)
(ByteString compare:with:collated:)
(ByteString translate:from:to:table:)
(ByteString findFirstInString:inSet:startingAt:)
(ByteString indexOfAscii:inString:startingAt:)
(ByteString findSubstring:in:startingAt:matchTable:)
(ByteArray hashBytes:startingWith:)
(SampledSound convert8bitSignedFrom:to16Bit:)
)

means that Pharo uses #indSubstringViaPrimitive:in:startingAt:matchTable: while squeak uses #findSubstring:in:startingAt:matchTable:.��

Ok maybe I not understand anything :) But to clarify lets look at image side methods.
in Squeak:

ByteString>>findSubstring: key in: body startingAt: start matchTable: matchTable
<primitive: 'primitiveFindSubstring' module: 'MiscPrimitivePlugin'>

in Pharo:

String>>findSubstringViaPrimitive: key in: body startingAt: start matchTable: matchTable
<primitive: 'primitiveFindSubstring' module: 'MiscPrimitivePlugin'>

So to me they both uses same VM primitive primitiveFindSubstring. Does they are really different inside VM?��

No they're not different; they're the same.�� But the primitive works only with ByteString, so it should not be on String where it will try and work on WideString and return completely incorrect results.

--
_,,,^..^,,,_
best,��Eliot