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

Ignacio Sniechowski 0800nacho at gmail.com
Wed Feb 22 04:24:58 PST 2023


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.
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.
*Thanks Hilaire!*
*cheers*


*Ignacio Sniechowski*



















On Wed, Feb 22, 2023 at 8:33 AM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Le 22/02/2023 à 12:30, Hilaire Fernandes a écrit :
>
> it looks like in the former one there is a composition between two
> different character (u=117 and ^) and in the *former* one it is just the
> encoding of one character (û).
>
> In the latter one
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230222/34284fbd/attachment.htm>


More information about the Cuis-dev mailing list