[Cuis-dev] Some questions on The Cuis Book & other questions

Hilaire Fernandes hfern at free.fr
Wed Feb 22 06:23:04 PST 2023


Hum, ok I see.

I will change again the unicode related paragraph. If I am understanding 
right, the implementation have been recently updated to have the 
behavior you describe.

I  observe now this behavior, contrary to the one documented in the book:

'sur' == 'sur' copy -> false
'sûr' == 'sûr' copy -> true


Le 22/02/2023 à 13:24, Ignacio Sniechowski a écrit :
> Yes,
> I can confirm that. But also what puzzles me is the fact that as per 
> The Cuis Book all strings in Cuis are Unicode (UTF-8) so there must be 
> instances of UnicodeString.

Yep, things evolved in Cuis, I will update the book. Thanks for the finding.

I will borrow your examples if you don't mind.

> But 'hello' is just an instance of class String and being an instance 
> of class String makes it mutable while UnicodeStrings are immutable.
>
> Here is the case:
> 'hello' class.                                  " String "
> 'hello' at: 2 put: $a; yourself.                    " 'hallo' "
>
> 'paragüas' at: 6.                                   "$ü"
> 'paragüas' class.                                   " UnicodeString "
> 'paragüas' at: 6 put: $u.                           "Instances of 
> UnicodeString are not indexable"
> 'paragüas' asByteString class.                      " String "
> 'paragüas' asByteString at: 6 put: $u; yourself.    " 'paraguas' "
> *
> *
> *
> *
> So my confusion comes from this paragraph:
> *
> *
> /"Note. We wrote earlier a string is a collection of characters. It is 
> true for byte string, where each character is encoded with a byte – a 
> byte string. However since 2023, the default string format for 
> Cuis-Smalltalk is Unicode (UTF-8) where each character can be encoded 
> with 1, 2, 3 or 4 bytes. Therefore it is immutable and can not be 
> indexed, it can be converted as byte string with the message 
> #asByteString."/
> *
> *
> It seems that not all strings are UnicodeStrings by default unless 
> they have a Unicode character.

Yep, the behavior in Cuis changed. It was not a good idea of me to 
update the book too quickly while Cuis was in flux, but that's fine.



> *Thanks Hilaire!*
> *cheers*
> **

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230222/7ecf97b6/attachment-0001.htm>


More information about the Cuis-dev mailing list