aString asSymbol during simulation

Alejandro F. Reimondo aleReimondo at sugarweb.com
Fri Sep 11 23:17:35 UTC 1998


During simulation if you send the message #asSymbol
 to aString, the method Symbol class>>intern: is activated
 and the symbol table is traversed looking for aSymbol
 that matches aString.
The piece of code is...

....[snip]...
1 to: table size do: [:i |
  aString size = (table at: i) size
    ifTrue: [ aString = (table at: i) ifTrue: [^ table at: i] ]
].
....[snip]...

the problem is that when i=166
 the result of (table at:i) is #simulatorFail
 (the #at: method in Array is a primitive method)
 then the simulator thinks that the #at: primitive
 has failed aborting the simulation.

Provably the problem can be solved considering
 that if a primitive method returns #simulatorFail
 and the selector is #at: with anArray as receiver.
 
Who knows a better solution?

Ale.





More information about the Squeak-dev mailing list