[Newbies] Tables for WideString?

Алексей almih99 at mail.ru
Thu Jun 29 18:58:06 UTC 2006


Hello, Yoshiki.

Thanks for detailed answer.
It was in image 3.8 from squeak.org

I fix problem by creating accessors to mentioned tables in String and
overriding them in WideString. Also some small changes in Character
and new class wideCharacterSet.

About "variableWordSubclass" and  other.
I have no words... To create class I send message to it superclass!!!
It is beutiful way.
I'd understand how it work only after question was posted. Before I
thought, that it is a kind of 'keyword' :)

Alexei.

>> 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
> numbers.
> 
>   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