Hi All,<br><br>&nbsp;&nbsp;&nbsp; having just stumbled across the fact that only characters with codes from 0 to 255 are unique I wondered whether anyone has considered doing the following:<br><br>Character addClassVarNamed: &#39;LargeCodeCharacters&#39;.<br>


<br><br><i>Character class methods for class initialization</i><br><b>initialize</b><br>&nbsp;&nbsp;&nbsp; <font color="#000000">[</font><font color="#6b6b6b"><b>LargeCodeCharacters</b></font> := <b>WeakSet</b> <span style="color: rgb(0, 0, 153);">new</span><br>
<br><br><i>Character class methods for instance creation</i><br><b>value:</b><font color="#000000"> </font><font color="#00007f"><i>anInteger</i></font><font color="#000000"> <br>

&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007f00"><i>&quot;Answer the Character whose value is anInteger.&quot;</i></font><font color="#000000"><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f7f7f">|</font><font color="#000000"> </font><font color="#6b6b6b"><i>theCharacter</i></font><font color="#000000"> </font><font color="#6b6b6b"><i>existingInstanceOrNil</i></font><font color="#000000"> </font><font color="#7f7f7f">|</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#00007f"><i>anInteger</i></font><font color="#000000"> </font><font color="#00007f">&lt;=</font><font color="#000000"> </font><font color="#7f0000">255</font><font color="#000000"> </font><font color="#00007f">ifTrue:</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">[</font><font color="#7f0000"><b>^</b></font><font color="#6b6b6b"><b>CharacterTable</b></font><font color="#000000"> </font><font color="#00007f">at:</font><font color="#000000"> </font><font color="#00007f"><i>anInteger</i></font><font color="#000000"> </font><font color="#00007f">+</font><font color="#000000"> </font><font color="#7f0000">1</font><font color="#000000">]</font><font color="#000000">.</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#6b6b6b"><i>theCharacter</i></font><font color="#000000"> </font><b>:=</b><font color="#000000"> </font><font color="#7f0000"><b>self</b></font><font color="#000000"> </font><font color="#00007f">basicNew</font><font color="#000000"> </font><font color="#00007f">setValue:</font><font color="#000000"> </font><font color="#00007f"><i>anInteger</i></font><font color="#000000">.</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0000"><b>^</b></font><font color="#000000">(</font><font color="#6b6b6b"><i>existingInstanceOrNil</i></font><font color="#000000"> </font><b>:=</b><font color="#000000"> </font><font color="#6b6b6b"><b>LargeCodeCharacters</b></font><font color="#000000"> </font><font color="#00007f">like:</font><font color="#000000"> </font><font color="#6b6b6b"><i>theCharacter</i></font><font color="#000000">)</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#00007f">ifNil:</font><font color="#000000"> </font><font color="#000000">[</font><font color="#6b6b6b"><b>LargeCodeCharacters</b></font><font color="#000000"> </font><font color="#00007f">add:</font><font color="#000000"> </font><font color="#6b6b6b"><i>theCharacter</i></font><font color="#000000">]</font><font color="#000000"><br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#00007f">ifNotNil:</font><font color="#000000"> </font><font color="#000000">[</font><font color="#6b6b6b"><i>existingInstanceOrNil</i></font><font color="#000000">]</font><font color="#000000"></font><font color="#000000"><br>
<br><br>Yes this has the potential to create a lot of space overhead, but only for artificial codes that enumerate over all characters.&nbsp; I suspect that for most cases the actual set of active characters would be quite small.<br>
<br>(Alternatives that are indexed by integers might also work well, e.g. a flat WeakValueDictionary that used a WeakArray for its values).<br><br>Just a thought...<br></font>