Issues creating instance of SmallInteger

Michael Haupt mhaupt at
Fri May 12 16:10:14 UTC 2006

Hi again,

On 5/12/06, Michael Haupt <mhaupt at> wrote:
> > If somebody can tell me why it isn't possible to create a SmallInteger like this, and give me a way to do it, I'd appreciate...
> [...]
> Hope that helps,

well, sorry for forgetting to actually answer your question. :-P

So, these SmallIntegers are always created implicitly when performing
computations. No allocation is associated with creating one, it's
purely arithmetics. So, it doesn't make sense to send #new to
SmallInteger - if you need one, say, 42, just create it by typing 42
in a workspace and inspecting it.

Another neat feature of this representation is, by the way, that you
cannot possibly have two different instances of SmallInteger
representing the same number. SmallInteger equality is simply checked
by comparing the pointers. Very cheap.



More information about the Squeak-dev mailing list