<br><br><div class="gmail_quote">On Wed, Dec 16, 2009 at 9:44 AM, Lukas Renggli <span dir="ltr">&lt;<a href="mailto:renggli@gmail.com">renggli@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt; :) :)  This is funny.  VisualWorks has exactly the same bug^H^H^Hfeature.<br>
&gt;  And if you look at the ANSI standard (ok, this is from the draft, but it is<br>
&gt; essentially the actual document) there is an exception for precisely this<br>
&gt; case,  See the last sentence in section 3.4.4 Blocks:<br>
&gt;<br>
&gt; If a block has no &lt;block body&gt; or no &lt;statements&gt; in its &lt;block body&gt; then<br>
&gt; the value of the block is undefined.<br>
<br>
</div>Ok, I did not check that document. I somehow expected that all empty<br>
blocks would return nil.<br></blockquote><div><br></div><div>As do we all, which is why this is so horribly broken :)  The sad thing is, we&#39;ve been living with it for thirty years.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
&gt; Which allows [] to be implemented as e.g. [Random new next].  In fact both<br>
&gt; VisualWorks and Squeak answer the last argument:<br>
&gt; [:a ] value: 1 1<br>
&gt; [:a :b|] value: 1 value: 2 2<br>
&gt; [:a :b :c :d :e :f :g :h| ] valueWithArguments: (1 to: 8) 8<br>
&gt; [:a | nil] value: 1 nil<br>
&gt; [:a :b| nil] value: 1 value: 2 nil<br>
&gt; At least it is consistent whether the block is inlined or not ;)<br>
&gt; 1+2 ifNotNil: [:arg|] 3<br>
&gt; It as ever been so.<br>
<br>
</div>Thank you for the additional insight. I learned something new on the<br>
Smalltalk semantics today :-)<br>
<br>
I will fix my code then.<br>
<div class="im"><br>
&gt; P.S.  I&#39;m caught between wanting to fix it and wanting to let sleeping dogs<br>
&gt; lie.  I&#39;d like to know what all the other dialects do.  If a substantial<br>
&gt; majority have the same curio I think we have to live with this, uh,<br>
&gt; ornament.  Just to be clear, making it a preference is a sick joke on my<br>
&gt; part.<br>
<br>
</div>I think we&#39;d better let it sleep. In my image I have 61 empty blocks<br>
with one or more argument. Some of them might depend on that hidden<br>
behavior.<br>
<br></blockquote><div><br></div><div>I like Peter&#39;s response.  How about making it a preference? ;) ;)  What I mean is we replace the code by something that compiles code that either raises an error or answers nil.  y default the preference is set to generate the error code.  Then we force people to write [:arg| nil] because [:arg| ] will generate a run-time error (with a verbose and helpful explanatory comment).  Then in a few months, years, decades we&#39;ll be in a position to remove the preference and generate code that answers nil because all the uses will have been caught.</div>
<div><br></div><div>I can imagine wanting to keep the preference and turning it on when importing code from other dialects for error checking.  </div><div><br></div><div>The downside to this approach is that empty blocks with arguments will include the &quot;nil&quot; noise.  But that;s very easy to remove automatically once the putsch is stable.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Lukas<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Lukas Renggli<br>
<a href="http://www.lukas-renggli.ch" target="_blank">http://www.lukas-renggli.ch</a><br>
</div></div></blockquote></div><br>