<div dir="ltr"><div>Well, as you were the last modifier, I prefer to have your advice :)<br><br></div>Nicolas<br></div><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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, 4 Sep 2013, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
</blockquote>
<br></div>
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<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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>
</blockquote>
<br>
</div></div></blockquote></div><br></div>