[Cuis-dev] Some questions on The Cuis Book & other questions
Juan Vuletich
juan at cuis.st
Wed Feb 22 11:10:33 PST 2023
On 2/22/2023 12:39 PM, Hilaire Fernandes via Cuis-dev wrote:
>
> Oops too late I already update the book (html updated, no the pdf build)
>
> https://cuis-smalltalk.github.io/TheCuisBook/Message-to-string-entities.html#index-Unicode
>
> https://cuis-smalltalk.github.io/TheCuisBook/String-_002d_002d-a-particular-collection.html#index-Unicode-2
>
>
> Le 22/02/2023 à 16:00, Hernán Wilkinson via Cuis-dev a écrit :
>> 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.
>>
> Yes, I remember that too.
>
> --
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu
Hi Folks,
A few clarifications (some / most you all already figured out)
- String literals containing only ASCII characters are instances of String
- String literals containing any non-ASCII character are instances of
UnicodeString
- Both are correctly indexed. #at: works as expected. But the same
UnicodeString can be encoded in various forms. See #asNFC, #asNFD,
UnicodeString>>#=. This is just the way Unicode works.
- String and UnicodeString are interchangeable and interoperable.
Conversions are done automatically. You don't need to care, except for:
- UnicodeString are immutable
An important note is that we can make UnicodeString modifiable via
#at:put: if we want. In most systems Unicode strings can not be
modified. But in Cuis we can compute and store the new 'bytes', nil
'hash' and we are done. On one hand, the system works well with
immutable strings. It is not really needed. On the other hand, making
them modifiable improves compatibility with older code and tutorials,
and other dialects. It is also a good example of Smalltalk "magic".
Hilaire, after we make our minds wrt immutable or mutable
UnicodeStrings, I'd like to rewrite those sections on the book. In last
year's Smalltalks conference at Buenos Aires, I presented a short paper
on Unicode in Cuis: https://openreview.net/pdf?id=c93fukpVINA . The main
point I make is that most programmers usually don't need to know or care
about the encoding used for Strings. They should only care about their
behavior. So, I'd like to rewrite those parts in the same spirit.
Thanks,
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich '
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230222/e96b40bb/attachment.htm>
More information about the Cuis-dev
mailing list