<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    At Deep Into Smalltalk at Lille in March Noury Bouraqadi presented a
    simple example of remote messaging. (The exampes are here
    <a class="moz-txt-link-freetext" href="http://car.mines-douai.fr/noury/docs">http://car.mines-douai.fr/noury/docs</a> ). <br>
    <br>
    You have two images. One is a proxy; the other is the server. You
    send a message to the proxy and it appears on the Transcript of the
    server. <br>
    <br>
    proxy := Proxy newOnPort: 5432.<br>
    proxy cr; show: 'This is my boomstick!'.<br>
    <br>
    So you send a message to Proxy, which understands absolutely
    nothing. Zilch. It defaults to #doesNotUnderstand:, which captures
    the message as an instance of Message. <br>
    <br>
    doesNotUnderstand: <b>aMessage</b><br>
    &nbsp;&nbsp;&nbsp; "Message answer is not handled!"<br>
    &nbsp;&nbsp;&nbsp; | messageBytes |<br>
    &nbsp;&nbsp;&nbsp; <b>aMessage</b> lookupClass: nil.<br>
    &nbsp;&nbsp;&nbsp; messageBytes := ReferenceStream streamedRepresentationOf: <b>aMessage</b>.<br>
    &nbsp;&nbsp;&nbsp; socketStream := SocketStream <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; openConnectionToHostNamed: 'localhost' <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; port: portNumber.<br>
    &nbsp;&nbsp;&nbsp; socketStream isConnected ifFalse: [^nil].<br>
    &nbsp;&nbsp;&nbsp; [socketStream sendCommand: messageBytes] ensure: [socketStream
    close].<br>
    <br>
    You can see here that it is serialized by ReferenceStream, shot over
    the wire by SocketStream. It is de-serialized here in the server
    image: <br>
    <br>
    dispatch: messageBytes<br>
    &nbsp;&nbsp;&nbsp; | message |<br>
    &nbsp;&nbsp;&nbsp; <b>message</b> := ReferenceStream unStream: messageBytes.<br>
    &nbsp;&nbsp;&nbsp; <b>message</b> sendTo: Transcript &nbsp;&nbsp;&nbsp; &nbsp; <br>
    <br>
    The important part is the last line, which has the Message instance
    sent #sendTo: and so for all intents and purposed you have send this
    old standby: <br>
    <br>
    Transcript show: 'This is my boomstick!'<br>
    <br>
    except the Transcript is not yours; it's somebody else's. <br>
    <br>
    Now let's look at Croquet/Qwaq FarRef&gt;&gt;#doesNotUnderstand:
    which has a class comment that says: <br>
    <br>
    "I represent a reference to an object living on another island. When
    I receive a message I pass the message on to the object."<br>
    <br>
    The class FarRef looks to me to be the same as Noury's Proxy: it
    understands no selectors; it uses a #doesNotUnderstand: override to
    capture the message; and, sends the message over the wire. <br>
    <br>
    The implementation of #doesNotUnderstand: is not clear to me, so
    I'll stick to the class comment as my proof. Does Qwaq use
    ReferenceStream to serialize? I don't know. <br>
    <br>
    In Spoon we have Other&gt;&gt;#doesNotUnderstand: which has this
    class comment: <br>
    <br>
    "Each of my instances respresents an object in another memory,
    reachable through a NetStream. Messages sent to one of my instances
    are forwarded to the remote object, and another Other is answered."<br>
    <br>
    It has #doesNotUnderstand: with a simple #forward: selector<br>
    <br>
    &nbsp;&nbsp;&nbsp; doesNotUnderstand: aMessage<br>
    &nbsp;&nbsp;&nbsp; ^self forward: aMessage<br>
    <br>
    and then: <br>
    <br>
    <br>
    &nbsp;&nbsp;&nbsp; forward: aMessage<br>
    &nbsp;&nbsp;&nbsp; "Forward aMessage to the remote object I represent, and answer
    the result."<br>
    &nbsp;&nbsp;&nbsp; "This message was invoked by the virtual machine, in response to
    an attempt to send aMessage to me."<br>
    <br>
    &nbsp;&nbsp;&nbsp; "Transcript cr; print: aMessage; endEntry."<br>
    &nbsp;&nbsp;&nbsp; ^(<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ReflectiveBehavior<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; at: aMessage selector<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifAbsent: [<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ^OutgoingMessageExchange<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; forward: aMessage<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for: remoteIdentity<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; over: session]<br>
    &nbsp;&nbsp;&nbsp; )<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value: session<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value: aMessage arguments<br>
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
    I think Craig may be familiar with the idea of a remote Transcript
    as he's included a class comment there that looks like Noury's
    simple program. The message gets passed to OutgoingMessageExchange.
    Does it use ReferenceStream to serialize? I don't know yet. <br>
    <br>
    To conclude, each of these different programs creates a proxy that
    understands no selectors, but uses #doesNotUnderstand to glean the
    message. Thus captured it sends it to a remote receiver. <br>
    <br>
    This is the beachhead I've needed to understand Spoon. I'll extend
    outward from this observation. <br>
    <br>
    Chris <br>
    &nbsp;&nbsp;&nbsp; &nbsp; <br>
  </body>
</html>