[squeak-dev] String & Text

Eliot Miranda eliot.miranda at gmail.com
Wed Jul 13 14:48:18 UTC 2022

Hi Marcel, Hi All,

_,,,^..^,,,_ (phone)

> On Jul 12, 2022, at 11:48 PM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
> Hi all --
> What are your thoughts on String and Text. In GUI programming, it
> is rather annoying to have to sprinkle #asText all over the code. It's
> nice to have most important protocol shared between String and Text.

As I wrote elsewhere, in VisualWorks Text & String provide much of the same api for manipulation (concatenation et al), search, etc, and differ for display.  Squeak is much weaker in this regard.

The architectural issue is that Text is a kind of string, and hence anything one can do to a string one naturally expects to be able to do to a Text.  Squeak should meet that expectation and currently it does not.

One of the issues is that functionality that could go in SequenceableCollection is put in String, I presume because people want something in String and don’t think abstractly enough about what that functionality is (an operation on sequences that they want to apply to character sequences).

I hope we can make it a medium term project to improve this part of the system with the related aims of moving functionality that apples to sequences up into SequenceableCollection, and making manipulation and search Apia polymorphic between Text and String.

> The recent change to only String >> #format: (see Collections-cmm.1016)
> to support symbols as placeholders indicates kind of a disagreement
> in how Text should be used in (GUI) code. Well, if some message is
> not there in Text, it is easy to find out. However, having a protocol there
> with different details feels rather challenging.
> I accept that not all protocols are shared between String and Text.
> I do not like inconsistencies of method implementations where the
> message (and signature) is identical.
> +1 for adding symbolic placeholders to Text >> #format: as well.
> Best,
> Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220713/cc01cd29/attachment.html>

More information about the Squeak-dev mailing list