Cuis-Smalltalk / Cuis-Smalltalk-Dev

Active development of Cuis Smalltalk
MIT License
429 stars 69 forks source link

Remove the need for #asByteString #243

Closed ghost closed 1 year ago

ghost commented 1 year ago

I'm just starting to learn Smalltalk, Cuis, and reading this https://cuis-smalltalk.github.io/TheCuisBook/Message-to-string-entities.html . I find having to use #asBytestring so often is a nuisance. Whether the (new) strings are implemented with 1 byte, or 1..4 bytes, per character is internal implementation detail that should not concern the end users of Cuis. It's like exposing users how intergers or others are implemented in Cuis.

IMO, the new strings should be able to correctly receive #at and #indexOf , as well as be changed using #at: #put: etc, without having to be converted to byte strings first (or at least not by the user, explicitely).

Also: I enter the array literal:

($h $i) .

and Cuis responds with: #($h(000068) $i(000069))

Or else, it goes against the simplicity and cleanliness aims of Cuis/Smalltalk, no?..

jvuletich commented 1 year ago

I agree that all Strings should be fully polymorphic, and users, especially people learning about Cuis, should not bother with their differences, or need to know about #asByteString. Still, UnicodeString doesn't support #at:put:. I think that in general modification of String should be discouraged, and not taught in an introductory text. I also suggest discussing this at our mail list https://lists.cuis.st/mailman/listinfo/cuis-dev . That's our forum for public discussion.

ghost commented 1 year ago

Alright, thanks for replying; I will write on that mailing list such suggestions in future.

jvuletich commented 1 year ago

This has already been addressed in The Cuis book.