<div dir="ltr"><div><div><div><div><div><div><div><div>After verification, xColon is not so rare, it is invoked for every block argument...<br>But we can safely replace (token := self step asSymbol) with (token := String with: self step), no problem.<br>

</div><br>We can even change it to (token := self step) if we are willing to remove last scories of alternate selectors beginning with $:<br>
</div><div>Indeed, #: and #:x  are obsolete squeakism which would not compile in other dialects (#&#39;:&#39; and #&#39;:x&#39; is the universally correct syntax).<br><br></div>Removing this feature consists in<br>- removing #colon reference in xLitQuote scanLitWord scanLitVec scanAllTokenPosition <br>


- removing asSymbol send in xColon.<br><br></div>But that would imply that methods with #: or #:x literals would not compile anymore<br></div>And that #( :x ) would result in #( #&#39;:&#39; #x ) instead of #( #&#39;:x&#39; ).<br>

</div>After my last hacking this would be a safe change in trunk (at least Compiler recompileAll works) and I&#39;m all for it, <br>... but who knows what could happen to exotic third-party code.<br></div><div>Having code load request resulting in a SyntaxError popping up is just one of the most annoying thing...<br>
</div><div>And having interpretation of a literal changing without any sort of indication is not much better!<br><br></div>#: would still be supported with (Scanner prefAllowUnicharSymbol: true) but not #:x<br></div>Maybe we could make it a preference too for smoother migration?<br>
</div>Or some sort of disambiguating request if interactive and conservative behavior if not, like I did for 1@-2?<br><div><div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Thoughts?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2013/9/11 Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div>Ah right, thanks Bert.<br></div>I think that the send of xColon is rare anyway (assignment cases := apart, in which case we do not send asSymbol)<br>

<br></div><div>#&#39;:&#39; is not referred directly in the Compiler stuff:<br>
</div>Let&#39;s see: (SystemNavigation default browseAllCallsOn: #&#39;:&#39;) -&gt; Oops yet another bug<br></div>See fix attached<br><br></div>Though I think asSymbol is necessary given implementation of scanLitWord, I&#39;ll look deeper later<br>


<div><div><br><br></div></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/11 Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>Another sender used to be #xColon. Not sure if we need to worry about that one.</div>


<div><br></div><div>CharAsSymbolSenders sortedCounts</div><div>==&gt; {6474-&gt;#scanToken . 141-&gt;#xColon}</div><div><br></div><div>(this was from before your compiler changes)</div><span><font color="#888888"><div>
<br><div><span style="border-collapse:separate;border-spacing:0px;font-size:12px"><div style="font-family:Helvetica">- Bert -</div><br></span></div></div></font></span><div><div><div><div>On 2013-09-06, at 01:58, Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:</div>


<br><blockquote type="cite"><div dir="ltr">Thanks Bert, I just published a Compiler version that does not...<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/5 Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span><br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On 2013-09-04, at 21:41, Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:</div>



<br><blockquote type="cite"><div dir="ltr">A rapid review of senders indicates that Character asSymbol seems rather rare in a trunk image.<br><br>I found <br>#initTextConstants<br>#inOutdent:delta: (Character tab asSymbol asText which is rather crooked way of avoiding an allocation - String tab would allocate a new Object).</div>



</blockquote><div><br></div></div><div>Scanner&gt;&gt;scanToken appears to be the most often used sender, and may well be the original reason for caching the 1-char symbols.</div><div><br></div><div>It might be a good idea to time compilation of complex methods with and without OneCharacterSymbols. (my guess is it wouldn&#39;t make much of a difference these days)</div>



<span><font color="#888888"><div><br></div><div><span style="font-family:Helvetica;font-size:12px">- Bert -</span></div></font></span><div><div><div><span style="font-family:Helvetica;font-size:12px"><br>
</span></div><br><blockquote type="cite"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/4 Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span><br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
There&#39;s another user of OneCharacterSymbols: Character &gt;&gt; #asSymbol. I don&#39;t know how often it&#39;s used (my guess is that it&#39;s rarely used), or how much slower it would be, if we were removing OneCharacterSymbols. The implementation would change from<br>





<br>
        ^Symbol internCharacter: self<br>
<br>
to<br>
<br>
        ^Symbol intern: self asString<br>
<br>
Which means that an extra String will be created, and the lookup is done in the WeakSets, instead of an Array/WeakArray.<br>
<br>
<br>
Levente<br>
<br>
On Wed, 4 Sep 2013, Nicolas Cellier wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Well, as you were the last modifier, I prefer to have your advice :)<br>
<br>
Nicolas<br>
<br>
<br>
2013/9/4 Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;<br>
      On Wed, 4 Sep 2013, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
            A new version of Collections was added to project The Inbox:<br>
            <a href="http://source.squeak.org/inbox/Collections-nice.530.mcz" target="_blank">http://source.squeak.org/<u></u>inbox/Collections-nice.530.mcz</a><br>
<br>
            ==================== Summary ====================<br>
<br>
            Name: Collections-nice.530<br>
            Author: nice<br>
            Time: 4 September 2013, 2:21:28.852 am<br>
            UUID: d732aa23-1c77-4c1e-abc0-<u></u>d8d4506b7f9f<br>
            Ancestors: Collections-ul.529<br>
<br>
            Fix this:<br>
             self assert: (allSymbols select: [:s | s = &#39;+&#39;]) size = 1.<br>
<br>
            1) It is un-necessary to enumerate the 1-char symbols, they already are in SymbolTable (the first time they were created via #findIntern: or by virtue of last #rehash) !<br>
<br>
            2) We can use a WeekArray rather than an Array because there is no point in keeping a reference to unused 1-char symbols.<br>
<br>
            Maybe we should get rid of OneCharacterSymbols class var, but I didn&#39;t dare...<br>
<br>
<br>
I say we should nuke it. The only user is Symbol class &gt;&gt; #selectorsContaining:, but that method is pretty much broken:<br>
- it uses OneCharacterSymbols only for infix selectors<br>
- it can&#39;t find infix selectors longer than 2 characters<br>
- it tries to optimize some stuff, but wastes cycles on other stuff<br>
<br>
<br>
Levente<br>
<br>
<br>
      =============== Diff against Collections-ul.529 ===============<br>
<br>
      Item was changed:<br>
       ----- Method: Symbol class&gt;&gt;allSymbols (in category &#39;access&#39;) -----<br>
       allSymbols<br>
              &quot;Answer all interned symbols&quot;<br>
              ^Array streamContents:[:s|<br>
                      s nextPutAll: NewSymbols.<br>
      -               s nextPutAll: OneCharacterSymbols.<br>
                      s nextPutAll: SymbolTable.<br>
              ].<br>
       !<br>
<br>
      Item was changed:<br>
       ----- Method: Symbol class&gt;&gt;initialize (in category &#39;class initialization&#39;) -----<br>
       initialize<br>
<br>
              &quot;Symbol initialize&quot;<br>
<br>
              Symbol rehash.<br>
      +       OneCharacterSymbols := WeakArray new: 256.<br>
      +       (0 to: 255) do: [ :byte | byte asCharacter asSymbol].<br>
      -       OneCharacterSymbols := nil.<br>
      -       OneCharacterSymbols := (1 to: 256) collect: [ :i | (i - 1) asCharacter asSymbol].<br>
              Smalltalk addToShutDownList: self.<br>
       !<br>
<br>
      Item was changed:<br>
       ----- Method: Symbol class&gt;&gt;internCharacter: (in category &#39;instance creation&#39;) -----<br>
       internCharacter: aCharacter<br>
              aCharacter asciiValue &gt; 256 ifTrue:[^self intern: aCharacter asString].<br>
      +       ^(OneCharacterSymbols at: aCharacter asciiValue + 1) ifNil: [OneCharacterSymbols at: aCharacter asciiValue + 1 put: (self intern: aCharacter asString)]<br>
      -       OneCharacterSymbols ifNil: [^self intern: aCharacter asString].<br>
      -       ^OneCharacterSymbols at: aCharacter asciiValue + 1<br>
       !<br>
<br>
      Item was changed:<br>
       ----- Method: Symbol class&gt;&gt;selectorsContaining: (in category &#39;access&#39;) -----<br>
       selectorsContaining: aString<br>
              &quot;Answer a list of selectors that contain aString within them. Case-insensitive.  Does return symbols that begin with a capital letter.&quot;<br>
<br>
              | size selectorList ascii |<br>
<br>
              selectorList := OrderedCollection new.<br>
              (size := aString size) = 0 ifTrue: [^selectorList].<br>
<br>
              aString size = 1 ifTrue:<br>
                      [<br>
                              ascii := aString first asciiValue.<br>
      +                       ascii &lt; 128 ifTrue: [(OneCharacterSymbols at: ascii+1) ifNotNil: [:s | selectorList add: s]]<br>
      -                       ascii &lt; 128 ifTrue: [selectorList add: (OneCharacterSymbols at: ascii+1)]<br>
                      ].<br>
<br>
              (aString first isLetter or: [aString first isDigit]) ifFalse:<br>
                      [<br>
                              aString size = 2 ifTrue:<br>
                                      [Symbol hasInterned: aString ifTrue:<br>
                                              [:s | selectorList add: s]].<br>
                              ^selectorList<br>
                      ].<br>
<br>
              selectorList := selectorList copyFrom: 2 to: selectorList size.<br>
<br>
              self allSymbolTablesDo: [:each |<br>
                      each size &gt;= size ifTrue:<br>
                              [(each findSubstring: aString in: each startingAt: 1<br>
                                      matchTable: CaseInsensitiveOrder) &gt; 0<br>
                                                      ifTrue: [selectorList add: each]]].<br>
<br>
              ^selectorList reject: [:each | &quot;reject non-selectors, but keep ones that begin with an uppercase&quot;<br>
                      each numArgs &lt; 0 and: [each asString withFirstCharacterDownshifted numArgs &lt; 0]].<br>
<br>
       &quot;Symbol selectorsContaining: &#39;scon&#39;&quot;!<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br><br>
<br></blockquote></div><br></div>
<br></blockquote></div></div></div><div><span style="border-collapse:separate;border-spacing:0px;font-size:12px"><br></span>

</div>
<br></div><br><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div><br><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>