<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Nicolas,</p>
<p><br>
</p>
<p>> <span style="font-size: 12pt;">Is this really a problem?</span></p>
<div><br>
</div>
<div>From my point of view, this is clearly a bug. Otherwise, it would be an unnecessary restriction. Personally, it hurts my pride of the wonderful Smalltalk implementation a bit that such an edge case does not work properly ;)</div>
<div><br>
</div>
<div>Why shouldn't we fix a bug? Or why would you not consider it a bug? We already check <span style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;">blockExtent for nil at some other places. And the changeset is really small.</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"><br>
</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;">Best,</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;">Christoph</span></div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com><br>
<b>Gesendet:</b> Samstag, 28. Dezember 2019 16:41:40<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] [BUG] Cannot compile cascade sent to block</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Christoph,</div>
<div>it's possible that I've already fixed that a few years ago, but it was not considered useful enough.</div>
<div>Is this really a problem?<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le sam. 28 déc. 2019 à 15:53, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div id="gmail-m_-133881663338805227divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi all! :-)</p>
<p><b><br>
</b></p>
<p><b>Steps to reproduce:</b></p>
<p>Do it:</p>
<p></p>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div>[true]</div>
<div><span style="white-space:pre-wrap"></span>whileTrue;</div>
<div><span style="white-space:pre-wrap"></span>whileFalse</div>
</blockquote>
<div></div>
<div><br>
</div>
<div><b>Expected behavior:</b></div>
<div>The script is compiled and executed (and an infinite loop occurs).</div>
<div><br>
</div>
<div><b>Actual behavior:</b></div>
<div><img size="43032" id="gmail-m_-133881663338805227img437184" style="max-width: 99.9%;" src="cid:16f4d2a6581f456b1e51"><br>
</div>
<div><br>
</div>
<div><b>Further investigations:</b></div>
<div>In #<span>analyseTempsWithin:rootNode:assignmentPools:, the inner BlockNode [true] is not computed a blockExtent, because it is optimized.</span></div>
<div><span>This leads to a nil key in the ByteCodeEncoder's blockExtentsToLocals.</span></div>
<div><span>A fast solution would be to skip nil blockExtents in #<span>noteBlockExtent:hasLocals:, but that's a dirty workaround.</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span><b>Similar bug:</b></span></span></div>
<div><span><span>Try to do:</span></span></div>
<blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px">
<div><span><span>
<div>Object newSubclass compile:  'iWontCompile: foo</div>
</span></span></div>
<div><span><span>
<div><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span>foo.</div>
</span></span></div>
<div><span><span>
<div><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span>[true]</div>
</span></span></div>
<div><span><span>
<div><span style="white-space:pre-wrap"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span></span>whileTrue;</div>
</span></span></div>
<div><span><span>
<div><span style="white-space:pre-wrap"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px;white-space:pre-wrap"></span></span>whileFalse'</div>
</span></span></div>
</blockquote>
<div><span><span>
<div></div>
<div></div>
<div></div>
</span></span></div>
<div>Fails with:</div>
<div><img size="38107" id="gmail-m_-133881663338805227img760294" style="max-width: 99.9%;" src="cid:16f4d2a6581f456b1e52"><br>
</div>
<div>Again, the problem is that blockExtent isNil.</div>
<div><br>
</div>
<div><b>Workaround:</b></div>
<div>Send #yourself to the block before sending the cascade. This prevents the receiver from being optimized.</div>
<div><br>
</div>
<div>Please note that this problem does not only occur in case of special blocks. For example, <span style="font-size:12pt">[Sensor anyButtonPressed] </span><span style="font-size:12pt">whileTrue; </span><span style="font-size:12pt">whileFalse fails as well.</span></div>
<div><br>
</div>
<div><br>
</div>
<div>How to fix this appropriately? I'm not sure whether I understand the whole idea of blockExtent so far. According to the documentation comment, it should be okay to be nil; however, the #blockExtent comment does not mention this fact.</div>
<div>Please see the attached changeset for an approach to fix the issue. All tests from KernelTests-Methods and most tests from Test-Compiler pass it, except of the testAllNodePCs* which time out in my fresh image. It would be great to hear if this is the right
 way to solve the bug, or just extending a workaround :-)</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
<div id="gmail-m_-133881663338805227Signature">
<div id="gmail-m_-133881663338805227divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-133881663338805227Item.MessagePartBody">
<div id="gmail-m_-133881663338805227Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-133881663338805227divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-133881663338805227Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
</div>
</body>
</html>