Hi - in porting the Type Inference Engine to Pharo, I came across this
problem.
I was using the Interpreter class to help translate from the number of a
primitive into a meaningful selector (eg from 1 to primitiveAdd).
Any ideas how to achieve something similar in Pharo?
Assuming primitive numbers haven't changed, I could just copy that
method...
- Francisco
In Squeak 2.8:
Interpreter class >> initializePrimitiveTable****
"This table generates a C switch statement for primitive
dispatching."****
** **
"NOTE: The real limit here is 2047, but our C compiler
currently barfs over 700"****
MaxPrimitiveIndex _ 700.****
PrimitiveTable _ Array new: MaxPrimitiveIndex + 1.****
self table: PrimitiveTable from:****
#( "Integer Primitives (0-19)"****
(0 primitiveFail)****
(1 primitiveAdd)****
(2 primitiveSubtract)****
(3 primitiveLessThan)****
(4 primitiveGreaterThan)****
(5 primitiveLessOrEqual)****
(6 primitiveGreaterOrEqual)****
(7 primitiveEqual)****
(8 primitiveNotEqual)****
(9 primitiveMultiply)****
(10 primitiveDivide)****
(11 primitiveMod)
:
<and so on>