March 28, 2024

ByteString and TwoByteString

 

When you get to Block IV, you will encounter fixed size collections including the classes ByteString and TwoByteString.

ASCII code uses 7 bits to define 128 alphanumeric characters i.e. all the characters on your keyboard. The later ANSI system extended the number of characters that could be represented with 8 bit (one byte) code. Later on, more 'exotic' characters needed to be represented and it was decided to use two bytes of storage. Smalltalk implements this variety of characters with ByteString and TwoByteString.

In M206 you don't really need to worry, because the system takes care of everything and generally speaking you will simply use the abstract class String. The Smalltalk system will "know" which of the two subclasses is required.

« Back to FAQ page

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Up to top of page