<div dir="ltr"><div>Hi,</div><div><br></div>Maybe it would be better if they did not share so much of the protocol. So that the system guided you better when to use String and when to use Text, separating the responsibilities more.<div><br></div><div>For example, I would argue that the asText send is misplaced in this example from AbstractFont>>#browseGlyphsByCategoryOf:select:label:</div><div><br></div><div>separatorBlock := [:codePoints :category |<br>    (('\{1}\\' withCRs asText<br>        format: { Unicode generalCategoryLabels at: category+1 ifAbsent: ['n/a'] })<br>        addAttribute: (TextFontReference toFont: TextStyle defaultFixedFont);<br>        addAttribute: (PluggableTextAttribute evalBlock: [self browseGlyphsByCategoryOf: codePoints select: aBlock label: aLabelOrNil]);<br>        yourself) ].</div><div><br></div><div>asText could just as well come after the format:.</div><div><br></div><div>Later in the same method comes an example, which is not criticized so easily, where pieces with attributes already applied are inserted via format:</div><div><br></div><div>contents := (('Family name: {1}{6}\   Emphasis: {2}\ Point size: {3} ({4}ppi {5}px{7})\' withCRs asText format: { self familyName asText addAttribute: (PluggableTextAttribute evalBlock: [self explore]); yourself. [self emphasisString] on: Error do: [self subfamilyName]. self pointSize. self pixelsPerInch. self height. isRange ifTrue: [''] ifFalse: [' (selected code points)']. (self isTTCFont and: [(tmp := self extraGlyphScale) ~= 1]) ifFalse: [''] ifTrue: [' ', (tmp * 100) rounded asString, '%'] }) addAttribute: (TextFontReference toFont: TextStyle defaultFixedFont); yourself).</div><div><br></div><div>Many of the occurrences of Text>>format: that I saw are used to insert links in the text template, or highlighted pieces.<br><div><br></div><div>So I guess my opening statement is just dreaming without much practical expertise in the concrete matter. Since Text and String are already interchangeable in certain aspects, you cannot simply roll back without breaking lots of things. Under these circumstances I agree that they should behave equivalently for the protocol that they do share. Otherwise an existing pair of '...' and format: may suddenly fail if you put asText between the two later.</div></div><div><br></div><div><span style="color:rgb(0,0,0);font-family:Arial;font-size:13.3333px">+1 for adding symbolic placeholders to Text >> #format:, unless format: gets removed from Text or the feature gets removed from String again. ;-)</span></div><div><span style="color:rgb(0,0,0);font-family:Arial;font-size:13.3333px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial;font-size:13.3333px">Kind regards,</span></div><div><span style="color:rgb(0,0,0);font-family:Arial;font-size:13.3333px">Jakob</span></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mi., 13. Juli 2022 um 08:48 Uhr schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="gmail-m_4301598533651730604__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">Hi all --<div></div><div><br></div><div>What are your thoughts on String and Text. In GUI programming, it</div><div>is rather annoying to have to sprinkle #asText all over the code. It's</div><div>nice to have most important protocol shared between String and Text.</div><div><br></div><div>The recent change to only String >> #format: (see Collections-cmm.1016)</div><div>to support symbols as <span style="font-size:10pt">placeholders indicates kind of a disagreement</span></div><div><span style="font-size:10pt">in how Text should be </span><span style="font-size:10pt">used in (GUI) code. Well, if some message is</span></div><div><span style="font-size:10pt">not there in Text, it is </span><span style="font-size:10pt">easy to find out. However, having a protocol there</span></div><div><span style="font-size:10pt">with different details </span><span style="font-size:10pt">feels rather challenging.</span></div><div><br></div><div>I accept that not all protocols are shared between String and Text.</div><div>I do not like inconsistencies of method implementations where the</div><div>message (and signature) is identical.</div><div><br></div><div>+1 for adding symbolic placeholders to Text >> #format: as well.</div><div><br></div><div>Best,</div><div>Marcel</div></div><br>
</blockquote></div>