<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Forwarder</TITLE>
</HEAD>
<BODY>
<BR>

<P><FONT SIZE=2>Stephen Pair wrote:</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt;Great stuff!&nbsp; I'm very excited by your work, especially as a </FONT>
<BR><FONT SIZE=2>&gt; mechanism</FONT>
<BR><FONT SIZE=2>&gt; for delegation.&nbsp; I am </FONT>
<BR><FONT SIZE=2>&gt; &gt;currently using the Trampoline object, that I think you originally</FONT>
<BR><FONT SIZE=2>&gt; developed, Stephen.&nbsp; I am unsure</FONT>
<BR><FONT SIZE=2>&gt; &gt;of how the delegation mechanism would work with this forwarder, so</FONT>
<BR><FONT SIZE=2>&gt; please continue the ramblings at</FONT>
<BR><FONT SIZE=2>&gt; &gt;the bottom. </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Thanks!&nbsp; No, I didn't do the trampoline...someone else did (can't</FONT>
<BR><FONT SIZE=2>&gt; remember)...but, I incorporated into a little asynchronous messaging</FONT>
<BR><FONT SIZE=2>&gt; demo that I did.</FONT>
</P>

<P><FONT SIZE=2>Ah yes, so I did get that from you.&nbsp; I also have been working on an asynchronous messaging framework, so I did get the Trampoline idea and the asend protocol from you.&nbsp; I extended the contract somewhat.&nbsp; I wanted to allow asynchronous message sends, with the further constraint that returns or exceptions from that send must return to the sending Process.&nbsp; Thus I have the Trampoline with an AsyncMessageGenerator which creates a QueuedPromise and passes that with the AsyncMessageSend object.&nbsp; Both the send and the return go through the respective queues of the Objects communicating.&nbsp; This is done with secretaries, both a global and background Secretaries.&nbsp; I want to embed all of this into the VM, along the lines of ConcurrentSmalltalk.</FONT></P>

<P><FONT SIZE=2>&gt; &gt;[rob - delegation hooks] </FONT>
<BR><FONT SIZE=2>&gt; &gt;This is where I am a bit confused about how this may work in </FONT>
<BR><FONT SIZE=2>&gt; practice.</FONT>
<BR><FONT SIZE=2>&gt; I believe your usage was to</FONT>
<BR><FONT SIZE=2>&gt; &gt;coalesce the reference to a changable object, which would be</FONT>
<BR><FONT SIZE=2>&gt; polymorphic in protocol, to avoid the </FONT>
<BR><FONT SIZE=2>&gt; &gt;cost of a #become:.&nbsp; Is this right?&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Yes, roughly...I wouldn't think of it as coalescing...there are still</FONT>
<BR><FONT SIZE=2>&gt; two distinct objects, one just delgates everything it receives to the</FONT>
<BR><FONT SIZE=2>&gt; other.</FONT>
</P>

<P><FONT SIZE=2>Ok, but you maintain the same reference externally, even while the implementation of the Forwardee mutates.&nbsp; This is extremely interesting.</FONT></P>

<P><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&gt; &gt;If I were to use a delegation model, or a managed object</FONT>
<BR><FONT SIZE=2>&gt; &gt;model, then I think the forwardee is the delegator or manager.&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Actually, this is the opposite of the way I would describe </FONT>
<BR><FONT SIZE=2>&gt; it.&nbsp; I would</FONT>
<BR><FONT SIZE=2>&gt; describe the Forwarder as the delegator, and the forwardee as the</FONT>
<BR><FONT SIZE=2>&gt; delegatee (is that a word?)...I don't really remember what (if any)</FONT>
<BR><FONT SIZE=2>&gt; standard terminology has been established regarding delegation.</FONT>
</P>

<P><FONT SIZE=2>:-) I don't know if that is a word, but I have the wrong idea of a Delegator.&nbsp; Are you saying that it delegates method lookup?&nbsp; </FONT></P>

<P><FONT SIZE=2>More interesting to me are transparent proxies that maintains identity under self reference, forward all messages, and allows me to do management of the message send in a :before and :after sense.&nbsp; I don't want to have duplicate all of the protocol in a surrogate class for the proxied object.&nbsp; This is what I was thinking with the term Managed Objects.&nbsp; This management may include Security checks, faulting, async sending/remote sending and future management.</FONT></P>

<P><FONT SIZE=2>The Trampoline object subclasses from ProtoObject and so there is an identity problem, as well as not always forwarding all message sends.&nbsp; It does this with DNU, so that is the point at which I can do the :before and :after work.&nbsp;&nbsp; It isn't clear to me where I can do this with the Forwarder.&nbsp; I would like to configure the Forwarder with a manager, which could intercept the message send and transform it into a different type of send.&nbsp; </FONT></P>

<P><FONT SIZE=2>The possible solutions I know about are:</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>- Trampoline with a DNU, but the current version doesn't reroute all message sends.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>- MethodWrappers, I really haven't looked at these, but it doesn't present a new, managed reference.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>- Forwarder, but I don't see how to activate the Manager</FONT>
</P>

<P><FONT SIZE=2>Perhaps it is a delegator model I am looking for, with your ability to install custom lookup.&nbsp; This may be the managed sending that I want.&nbsp; I will have to read the Self papers and more about AOP.&nbsp; I can sense that maintenance of self and identity would be interesting in this Delegative model.</FONT></P>

<P><FONT SIZE=2>&lt;snip&gt;</FONT>
<BR><FONT SIZE=2>&gt; I think you've lost me...also the Forwarder would not be used </FONT>
<BR><FONT SIZE=2>&gt; at all in</FONT>
<BR><FONT SIZE=2>&gt; delegation (it can't because because no method will ever be activated</FONT>
<BR><FONT SIZE=2>&gt; for any of its instances)...in my mind delegation requires that you be</FONT>
<BR><FONT SIZE=2>&gt; able to send a message to an object, and receive any messages that are</FONT>
<BR><FONT SIZE=2>&gt; sent to self in the target method.&nbsp; It's kind of like dynamically</FONT>
<BR><FONT SIZE=2>&gt; subclassing the target object, but it only affects the instances</FONT>
<BR><FONT SIZE=2>&gt; involved, it is only in effect for the duration of the </FONT>
<BR><FONT SIZE=2>&gt; delegated message</FONT>
<BR><FONT SIZE=2>&gt; send, and the two objects remain distinct (having separate</FONT>
<BR><FONT SIZE=2>&gt; state...unlike subclassing, in which instances reflect a union of all</FONT>
<BR><FONT SIZE=2>&gt; instance variable in the class and its superclasses).</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; DNU comes into play when a delegated method context sends a message to</FONT>
<BR><FONT SIZE=2>&gt; self, which would get routed back to the delegator...which may not</FONT>
<BR><FONT SIZE=2>&gt; natively understand the message and desires to once again </FONT>
<BR><FONT SIZE=2>&gt; delegate (this</FONT>
<BR><FONT SIZE=2>&gt; is analogous to the the lookup of a method in the superclass chain).</FONT>
<BR><FONT SIZE=2>&gt; Alternatively, the delegator may implement the method, and choose to</FONT>
<BR><FONT SIZE=2>&gt; delegate it, optionally adding behavior of its own (this is </FONT>
<BR><FONT SIZE=2>&gt; analogous to</FONT>
<BR><FONT SIZE=2>&gt; a super send).</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Of course, you would need to support additional syntax to generate a</FONT>
<BR><FONT SIZE=2>&gt; &quot;delegated send&quot; bytecode. </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; So, having a mechanism to define a custom lookup could be beneficial.</FONT>
<BR><FONT SIZE=2>&gt; You could choose to first do a normal lookup, then try one of several</FONT>
<BR><FONT SIZE=2>&gt; instance variables for potential delegation, or any number of</FONT>
<BR><FONT SIZE=2>&gt; possibilites.&nbsp; I don't think calling back into Smalltalk for </FONT>
<BR><FONT SIZE=2>&gt; that would</FONT>
<BR><FONT SIZE=2>&gt; be an issue...the default case of a normal lookup has to be handled</FONT>
<BR><FONT SIZE=2>&gt; efficiently though.&nbsp; And, you have to be careful not to melt </FONT>
<BR><FONT SIZE=2>&gt; down into a</FONT>
<BR><FONT SIZE=2>&gt; infinte recursion trying to lookup the method lookup method lookup</FONT>
<BR><FONT SIZE=2>&gt; method lookup method lookup method lookup....you get the idea.&nbsp; But, I</FONT>
<BR><FONT SIZE=2>&gt; think if you want the real deal...you have to go all the way to Self.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I haven't experimented with the delegation aspect...so, there may be</FONT>
<BR><FONT SIZE=2>&gt; something in there that blows apart my whole notion of how it might</FONT>
<BR><FONT SIZE=2>&gt; work.&nbsp; I'm going to play around with the forwarding capability for a</FONT>
<BR><FONT SIZE=2>&gt; while first.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; - Stephen</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; </FONT>
</P>

<P><FONT SIZE=2>- Rob</FONT>
</P>

</BODY>
</HTML>