<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 3, 2017 at 1:56 PM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you could compile it as a literal, you should be able to decompile it as a literal too.<br>
If I'm not mistaken, only option 2. would do this.<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also, there are cases when the method was manipulated after compilation. In those cases perhaps the decompiler should raise a warning and create a brace array instead of the expression it creates now.</blockquote><div><br></div><div>+1 </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, 3 Apr 2017, Eliot Miranda wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
    I'm cleaning up the decompiler and the changes back in 2015 for deciding which characters are literal or not affects e.g. Date>>printOn: ::<br>
<br>
printOn: aStream<br>
<br>
self printOn: aStream format: #(1 2 3 $  3 1 )<br>
<br>
<br>
This currently decompiles as<br>
<br>
printOn: aStream <br>
self printOn: aStream format: ((Array new: 6) at: 1 put: 1; at: 2 put: 2; at: 3 put: 3; at: 4 put: Character space; at: 5 put: 3; at: 6 put: 1; yourself)<br>
<br>
I see four approaches<br>
<br>
1. live with it<br>
<br>
2. add an exception to LiteralNode>>printOn:indent: that invokes a special case Array print routine that forces printing as a Literal (this also requires special case printing in Character; I suggest we<br>
refactor all literal printing as printAsLiteralOn: if we take this approach)<br>
<br>
3. relent and allow space (but no other whitespace character) to be considered as a literal<br>
<br>
4. make an exception for Character space only when being printed in an Array:<br>
<br>
shouldBePrintedAsLiteralVisiti<wbr>ng: aSet<br>
<br>
^self shouldBePrintedAsLiteral or: [self == Character space]<br>
<br>
2. is I think the nicer.  It would allow LiteralNode to insist that a literal print itself as literal and hence would correctly decompile e.g. the legal (but rightly disapproved of)<br>
shouldBePrintedAsLiteralVisiti<wbr>ng: aSet<br>
<br>
^self shouldBePrintedAsLiteral or: [self == $ ]<br>
<br>
Thoughts, opinions?<br>
_,,,^..^,,,_<br>
best, Eliot<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>