<div dir="ltr">+1 add those spaces<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/1 Frank Shearar <span dir="ltr">&lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I decided to finally play around with Traits. I decided I was going to<br>
reinvent the field of integers by making a TGroup trait and composing<br>
two of those with some aliasing, just like how we get a(n algebraic)<br>
field from overlaying two groups together. I defined my field thusly:<br>
<br>
Object subclass: #MyInteger<br>
    uses: TGroup @ {#inverse -&gt; #negated. #* -&gt; #+} + TGroup @<br>
{#inverse -&gt; #reciprocal}<br>
    instanceVariableNames: &#39;value&#39;<br>
    classVariableNames: &#39;&#39;<br>
    poolDictionaries: &#39;&#39;<br>
    category: &#39;Algebra&#39;.<br>
<br>
But there&#39;s a problem. When I accept the above, the class definition<br>
prints out, and those Associations print themselves without<br>
whitespace. That means that &#39;#* -&gt; #+&#39; becomes &#39;#*-&gt;#+&#39;, which is the<br>
Symbol #*-&gt; followed by garbage. Using #&#39;*&#39; doesn&#39;t work, because #&#39;*&#39;<br>
printString == &#39;#*&#39;.<br>
<br>
The easy solution is to change Association&#39;s #printOn: to put<br>
whitespace around the -&gt; (and ditto for #storeOn:). But before I<br>
&quot;just&quot; do that, I&#39;d like to hear comments on the idea.<br>
<br>
It would mean that &quot;1-&gt;2&quot; would print as &quot;1 -&gt; 2&quot; (and storeString as<br>
&quot;(1 -&gt; 2)&quot;).<br>
<br>
I have a small test suite for the change, including this seemingly<br>
innocuous snippet, which fails with a SyntaxError when it runs:<br>
<br>
self assert: #+ -&gt; #bar equals: (Compiler evaluate: (#+ -&gt; #bar) storeString).<br>
<span class="HOEnZb"><font color="#888888"><br>
frank<br>
<br>
</font></span></blockquote></div><br></div>