Array new: 10
> #(nil nil nil nil nil nil nil nil nil nil)Array new: 5
> #(nil nil nil nil nil)Yes arrays can have different sizes
Use message variableSubclass: instead of subclass:
Example
ArrayedCollection variableSubclass: #Array
instanceVariableNames: ''
classVariableNames: ''
package: 'Collections-Sequenceable'Example
Object variableSubclass: #StrangePoint
instanceVariableNames: 'x y'
classVariableNames: ''
package: 'Collections-Sequenceable'new: maxat: and at:put:size returns the number of indexed instance variables| a |
a := Array new: 4.
a at: 2 put: 'lulu'.
a at: 1
> nil
a at: 2
> 'lulu'Counter has an instance variable named countArray has only an indexed instance variable| Indexed | Named | Definition Method | Examples | |
|---|---|---|---|---|
| No | Yes | #subclass:... | Color | |
| Yes | No | #variableSubclass: | AdditionalMethodState | |
| Yes | No | #variableByteSubclass: | ByteString | |
| Yes | No | #variableWordSubclass: | Bitmap |
Some methods related to class types: isPointers, isBits, isBytes, isFixed, isVariable
subclass: can have any kind of subclassesvariableSubclass: can only have variableSubclass: subclassesvariableSubclass: with an indexed instance variable new: at: and at:put: to access indexed values/