Hi David,<div><br></div><div>    Interesting!  To my mind that definition is incorrect.  I would expect the sender of a block to be the sender of the enclosing method, in which case the definition would arguably be</div><div>
<br></div><div>BlockClosure methods for accessing</div><div>sender</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^self home sender</div><div><br></div><div>A block activation&#39;s caller would be it&#39;s sender slot, so within a block you might refer to thisContext caller.  But what is arguably a bug in my implementation is that within a block activation thisContext sender refers to the caller (the sender of value: to the activation&#39;s block) not to the sender of the enclosing method.</div>
<div><br></div><div>I think I may have screwed up badly here and that the correct implementations should be</div><div><br></div><div><i>MethodContext methods for accessing</i></div><div><b>caller</b></div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>^closureOrNil</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>ifNil: [self error: &#39;this is a method activation and so has no caller&#39;]</div><div>
<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>ifNotNil: [sender]</div><div><br></div><div><b>sender</b></div><div><span class="Apple-tab-span" style="white-space: pre; "></span></div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span>^closureOrNil</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>ifNil: [sender]</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>ifNotNil: [closureOrNil outerContext sender]</div><div><div><br></div><div><i>BlockClosure methods for accessing</i></div>
<div><b>sender</b></div><div><b><span class="Apple-style-span" style="font-weight: normal; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>^outerContext sender</span></b></div><div><div><br></div></div></div>
<div>and either</div><div><br></div><div><i>BlockClosure methods for accessing</i></div><div><b>caller</b></div><div><b><span class="Apple-style-span" style="font-weight: normal; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>&quot;Since a BlockClosure is by definition not an activation it does not have a caller.</span></b></div>
<div><b><span class="Apple-style-span" style="font-weight: normal; "><span class="Apple-tab-span" style="white-space: pre; ">        </span> It has a sender because it is always created within the context of a method.&quot;</span></b></div>
<div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>^nil</div><div><br></div><div>or</div><div><br></div><div><i>BlockClosure methods for accessing</i></div><div><b>caller</b></div><div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>^self error: &#39;this is an inactive block and so has no caller&#39;</div>
<div><br></div><div><br></div><div>I believe the pre-closure definitions are</div><i>ContextPart methods for accessing</i></div><div><b>sender</b><br><span class="Apple-tab-span" style="white-space: pre; ">        </span>^sender</div>
<div><br><div><i>BlockContext methods for accessing</i></div><b>caller</b><br><span class="Apple-tab-span" style="white-space: pre; ">        </span>^sender</div><div><br></div><div>which to my mind is missing</div><br><div><i>BlockContext methods for accessing</i></div>
<b>sender</b><br><span class="Apple-tab-span" style="white-space: pre; ">        </span>^home sender</div><div><br></div><div>What do people think the right definitions should be?</div><div><br><div><div>On Fri, Dec 18, 2009 at 8:36 PM,  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;</span> wrote:</div>
</div></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">David T. Lewis uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-dtl.331.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-dtl.331.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-dtl.331<br>
Author: dtl<br>
Time: 18 December 2009, 11:32:44 am<br>
UUID: 20ffffda-86bc-47a7-8eae-cd11b55aa65e<br>
Ancestors: Kernel-bs.330<br>
<br>
Add BlockClosure&gt;&gt;sender required for MessageTally class&gt;&gt;tallySends:<br>
<br>
Harvested from Pharo (nice 4/14/2009 19:09).<br>
<br>
=============== Diff against Kernel-bs.330 ===============<br>
<br>
Item was added:<br>
+ ----- Method: BlockClosure&gt;&gt;sender (in category &#39;debugger access&#39;) -----<br>
+ sender<br>
+       &quot;Answer the context that sent the message that created the receiver.&quot;<br>
+<br>
+       ^outerContext sender!<br>
<br>
<br>
</blockquote></div><br></div>