[Newbies] Tables for WideString?

Yoshiki Ohshima yoshiki at squeakland.org
Wed Jun 28 19:30:50 UTC 2006

  Hello, Aleksei,

  Sorry for the slow response.

> I have problems with WideString. (realy not with WideString, but
> debugger brings me to this class). When I send #beginsWith: message to
> WideString, squeak invokes String>>beginsWith: and this method  use
> String>>findSubstring:in:startingAt:matchTable:
> For String matchTables (AsciiOrder CaseInsensitiveOrder
> CaseSensitiveOrder) contains 256 bytes.
> So when invoked 'matchTable at: myWideChar asciiValue + 1' -- i get
> error -- 'subscript is out of bounds'.
> How to fix this?
> I must create my own huge tables for wide strings?

  This must be a bug, I think.  It is fixed in Squeakland image, but
not incorporated into the mainstream yet.  What was the version you
found this?

> And another question.
> From class definition for WideString
> 'String variableWordSubclass: #WideString'
> What means 'variableWordSubclass' and is it restrict me in some way,
> or I can ignore this?

  There is a concept of the "variable class" in Smalltalk.  If you
take an instance of a normal class, its size is fixed (i.e., the
instance has a number of slots that is defined by the "class shape").
And, each slot are (usually) named, and the name is used to access
them in the user code.

  For a variable class, its instances can have different size.  For
example, the instances of Array can be different size, but share the
same behavior provided by the Array class.  The slots are index by

  A String in Squeak is like an Array.  Each (sub-)instance of it can
have different size.  A "variable word class" means that a slot of its
instance contains a 32-bit word (non-pointer), and a "variable byte
class" means a slot is 8-bit wide (obviously a non-pointer).

  The restriction?  You cannot have a named instance variable in
a non-pointer variable class.

-- Yoshiki

More information about the Beginners mailing list