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

Hernán Wilkinson hernan.wilkinson at 10pines.com
Wed Feb 22 07:00:17 PST 2023


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

> 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
>
If my memory does not fail me I remember talking with Juan about this
behavior and the reason for copy to return the same object is because
UnicodeString are immutable... but let's wait for Juan to confirm that.

Hernan.


>
>
> 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. Geohttp://drgeo.euhttp://blog.drgeo.eu
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230222/54e30c4e/attachment.htm>


More information about the Cuis-dev mailing list