<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"><<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>></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 -> #negated. #* -> #+} + TGroup @<br>
{#inverse -> #reciprocal}<br>
instanceVariableNames: 'value'<br>
classVariableNames: ''<br>
poolDictionaries: ''<br>
category: 'Algebra'.<br>
<br>
But there'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 '#* -> #+' becomes '#*->#+', which is the<br>
Symbol #*-> followed by garbage. Using #'*' doesn't work, because #'*'<br>
printString == '#*'.<br>
<br>
The easy solution is to change Association's #printOn: to put<br>
whitespace around the -> (and ditto for #storeOn:). But before I<br>
"just" do that, I'd like to hear comments on the idea.<br>
<br>
It would mean that "1->2" would print as "1 -> 2" (and storeString as<br>
"(1 -> 2)").<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: #+ -> #bar equals: (Compiler evaluate: (#+ -> #bar) storeString).<br>
<span class="HOEnZb"><font color="#888888"><br>
frank<br>
<br>
</font></span></blockquote></div><br></div>