Re: Tables for WideString?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Tables for WideString?

Yoshiki Ohshima
  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
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

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Tables for WideString?

Aleksej-3
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


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Tables for WideString?

Nicolas Cellier-3
Hello Alexei,

you can also check at http://bugs.impara.de/view.php?id=3574
where i put another version of WideCharacterSet a few weeks ago.

Nicolas

Le Jeudi 29 Juin 2006 20:58, Алексей a écrit :

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

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners