<!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>
"Message answer is not handled!"<br>
| messageBytes |<br>
<b>aMessage</b> lookupClass: nil.<br>
messageBytes := ReferenceStream streamedRepresentationOf: <b>aMessage</b>.<br>
socketStream := SocketStream <br>
openConnectionToHostNamed: 'localhost' <br>
port: portNumber.<br>
socketStream isConnected ifFalse: [^nil].<br>
[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>
| message |<br>
<b>message</b> := ReferenceStream unStream: messageBytes.<br>
<b>message</b> sendTo: Transcript <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>>#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>>#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>
doesNotUnderstand: aMessage<br>
^self forward: aMessage<br>
<br>
and then: <br>
<br>
<br>
forward: aMessage<br>
"Forward aMessage to the remote object I represent, and answer
the result."<br>
"This message was invoked by the virtual machine, in response to
an attempt to send aMessage to me."<br>
<br>
"Transcript cr; print: aMessage; endEntry."<br>
^(<br>
ReflectiveBehavior<br>
at: aMessage selector<br>
ifAbsent: [<br>
^OutgoingMessageExchange<br>
forward: aMessage<br>
for: remoteIdentity<br>
over: session]<br>
)<br>
value: session<br>
value: aMessage arguments<br>
<br>
<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>
<br>
</body>
</html>