Issues creating instance of SmallInteger
afunkyobject at yahoo.com
Mon May 15 20:44:07 UTC 2006
On May 12, 2006, at 11:32 AM, Michel Calonne wrote:
> I've got a problem creating objects via this sample of code:
> (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"...
> 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...
> And are there other classes behaving the same way? So that I can
> take them in account in my code.
You will not want to try generalizing your serialization/materialization quite so much. There are "immediate" types and globals that you will not want to create new instances of. Other examples are true, false and nil, Smalltalk, Processor, Transcript and others.
I've been through a ton of this kind of stuff in having written Magma. You might find looking at my serialization/materialization code helpful in this respect.
More information about the Squeak-dev