Issues creating instance of SmallInteger

Damien Pollet damien.pollet at
Fri May 12 16:11:22 UTC 2006

On 5/12/06, Michel Calonne <Michel.Calonne at> wrote:
> (Smalltalk at: #AClassName) new
> The problem is that, when trying to create an instance of SmallInteger, it raises an error :
> "SmallIntegers can only be created by performing arithmetic"...

That's because integers are pure values, they are immutable. It
wouldn't make sense to create several copies of 42... and if integers
had a working new, how would you choose which integer you get ? set
its value ? to what ?  :)  The only way to get hold of an integer is
via a literal value in the code or by combining existing integers by

In the VM, some objects are represented in a compact way for
performance reasons: instead of a pointer to the object data, you have
directly the value (if you know eiffel, that's the same as the
expanded types). I'm not sure which classes behave this way but most
probably all the ones with small memory footprint like characters,
numbers, etc

(hopefully I didn't say too much stupidities... :)

 Damien Pollet
 type less, do more

More information about the Squeak-dev mailing list