Posted by
Howard Stearns on
Jul 23, 2006; 8:35pm
URL: https://forum.world.st/camera-in-CroquetEvent-tp129366p129367.html
Andreas, you're right about the TFarRef happening outside a future
message. It happens in:
TChattyAvatarReplica>>prointerLeave: evt
super pointerLeave: evt.
self root signal: #hideID with: evt with: nickname.
In this case, we can change the above and TChattyAvatarUser>>hideID:
to just pass the evt userID.
Or we can change it to pass a copy of the event, as is done by:
TAvatarUserMenu>>doBlueButtonUp: event
| eventCopy |
eventCopy := event copy.
eventCopy selection: event selection copy.
eventCopy selection target future signal: #blueButtonUp with:
eventCopy.
But I'm not clear on the philosophy by which to decide what the right
path is. (I guess it would be up to Tony.) Naively, it seems weird
to have events be #passByClone:, only to have to have to make copies
whenever we want to actually pass one.
On Jul 22, 2006, at 10:07 PM, Andreas Raab wrote:
> Howard Stearns wrote:
>> What's the definition of "island discipline?" I think it has
>> something to do with no island (including the Island default)
>> holding on to any long-lived references to something in another
>> island.
>
> Really only that an object mustn't refer directly to objects in
> other islands.
>
>> - But there are exceptions that are allowed, such as classes.
>
> Unfortunately, yes. Couldn't make it work for the time being
> without those :-(((
>
>> - And I'm not sure what the limitations are on transiently held
>> references. Empirically, I know that the execution of a future
>> message from the Island default to another island can pass
>> something on to the Island default (e.g., a CroquetEvent), but I
>> imagine that the island better not store that reference such that
>> it's still around when the island tries to sync.
>
> With proper future messaging this isn't a problem. A CroquetEvent
> for example gets copied when it's passed into the island. So
> storing isn't a problem at all. Generally, all objects get copied
> when you pass them into an island unless you pass a reference to an
> object inside that island. The only exceptions are classes (as you
> noted above).
>
>> I don't know how to look at it right. Here's my thinking, but it
>> would lead me to believe that snapshots would reliably fail all
>> the time, which they don't:
>> The snapshot trace (below) shows that when the event holds the
>> camera, then the Island default (outside) has a reference to the
>> camera. OK, that's fair. And it shows that the island being
>> sync'ed has created a TFarRef to the camera. Thus the island
>> (inside) and the outside both reference the camera. Bad. I think
>> the reason the island makes a TFarRef to the camera is that event
>> handlers like #pointerDown: pass the CroquetEvent, which is
>> passByClone:, and so it tries to pass the camera in turn. Since
>> the camera is passByProxy:, it creates a TFarRef.
>
> Yes, but this wouldn't apply in the case of a future message. Your
> analysis makes sense in the situation that the event is used in a
> synchronous send; but I'm not sure where this would happen. Here is
> something to try: Change TCamera class>>howToPassAsArgument to
> something that will raise an error when you try to execute it (say
> #passByFoo:) to see where exactly that reference is created.
>
> Cheers,
> - Andreas
>