Ian Hickson wrote:
On Sat, 1 Mar 2008, Jonas Sicking wrote:
I updated the proposal recently (in response to similar feedback from
Adam or Collin) to say that when you pass an EndPoint through
postMessage(), what happens is that a clone EndPoint is made for
delivery on the other side, and the EndPoint you passed becomes
invalid.
So why bother with having one side create two endpoints just to have one
made invalid? It intoroduces two more objects (the pair and the second
endpoint) that the caller basically will just throw away. Wouldn't it be
better to have one side instead create just one endpoint (though I would
call it a messagePipe instead) and then make the postMessage
implementation create the other endpoint.
Because then you could only pass an endpoint across a pipe once. The idea
is to be able to send both ends across pipes many times.
Passing an endpoint multiple times would create multiple clones anyway
so I don't see the advantage to just passing in a pipe and have a new
other end of the pipe being created every time? But I don't really see
the use case for this anyway? If you really need to have multiple things
sending you events you might as well create multiple pipes all using the
same event handlers.
The one thing that I agree you couldn't do with my proposal is to pass
both ends of a pipe around. You also couldn't pass one end multiple
times. But again, I'd like to hear what the use case is?
And even that could be done by proxying messages.
/ Jonas