[Vm-dev] Implicit Character -> Integer conversion with basicAt:

Eliot Miranda eliot.miranda at gmail.com
Mon May 7 15:12:40 UTC 2018


Hi Clément,

    I provoked some protest last week by rewriting

String>>isAsciiString
    ^self allSatisfy: [ :each | each asciiValue <= 127 ]

as 

String>>isAsciiString
    1 to: self basicSize do: [:i| (self basicAt: i) > 127 ifTrue: [^false]].
    ^true

The speed up is around 5x to 6x.

The question comes does Scorch know that it can implicitly obtain Character asciiValue by substituting a suitable basicAt: for the at:, or is the chain of inference too complex (as yet)?

_,,,^..^,,,_ (phone)


More information about the Vm-dev mailing list