The five types of IBM Smalltalk objects include:
In addition, all of these object types except "immediate" can be marked as one of the following:
An immediate object's value is represented directly in the object pointer, with no data associated. In IBM Smalltalk, true, false, nil, Character, and SmallInteger are immediate. In C, true, false, and nil can be referenced as EsTrue, EsFalse, and EsNil, respectively.
IBM Smalltalk SmallIntegers range from -1073741824 to +1073741823.
Character values range from 0 to 65535.
A pointer object's instance variables or indexed slots contain references to other objects. An example of this type of object is Array.
Byte, word, and long objects have no named instance variables. The indexed slots contain bytes, word, or longs, respectively.
Pointer, byte, word, and long objects can be marked read-only. A read-only object cannot be stored into by Smalltalk.
The following methods relate to read-only objects:
Note: | For immediate objects in ROM, this method will always answer true because these objects are always read-only. |
If this method answers true, the store operation is retried. If the receiver has been marked read-write, the store will take place. If not, this message will be sent again. If this method answers false, the store operation is ignored.
Note: | storedObject and anInteger are suitable for instVarAt:Put: not at:put:. If the receiver is a String or DBString, storedObject will be an Integer, not a Character. |
Pointer, byte, word, and long objects can be made fixed. A fixed object cannot be moved by the Smalltalk garbage collector. Fixed objects can be used to provide C code with memory that can be used to store results (for example, a buffer for a communications interrupt handler). Once an object has been made fixed, its address does not change.
The following methods relate to fixed objects:
Note: | Fixed objects that become garbage are not garbage collected until the next time the image is started. At that time, IBM Smalltalk can be sure that there are no C code references to the object and the object can safely be collected. |