Hi,<br><br><div class="gmail_quote">On Wed, Jun 25, 2008 at 5:49 PM, Christian S <<a href="mailto:chsu79@gmail.com" target="_blank">chsu79@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

loop(Status) -><br>
  receive<br>
    worker: {available, Worker} -><br>
      addWorker(Status, Worker);<br>
    true: {job, Job} -><br>
      dispatch(Status, Job)<br>
  end.<br></blockquote></div><br>I'm not sure I get the reason why channels would be useful. I see two possibilities:<br>a) for performance, when each channel has a different mailbox<br>b) to simplify the code/architecture<br>
<br>
Regarding (a), this can be achieved without any syntax change (but not without a price) and with a convention that is already in use. A kind of "poor man's channels". Channels are identified by an Erlang term (a constant) and can be created dynamically. The default one has an empty id. A channel can be a separate mailbox or a data structure superimposed the mailbox to allow traversing only selected messages. Messages are tuples where the first element is the channel id. Any message not matching that is in the default channel. The price is that receiving messages is somewhat slower, since they must be sorted into the right channel. If no channels are defined, this price is minimal and everything works as usual. Also, the receive statements' patterns must explicitly contain the channel tag as a constant or a bound variable.<br>
<br>The above may also be utterly flawed, but it doesn't feel so right now, to me :-)<br>
<br>Regarding (b), I can't see how Erlang code can be made simpler. IMHO, in other languages/environments, the use of channels is a way to structure the code around the fact that there aren't any processes. The channels can be asynchronous and Erlang-like coding can be used. But we already have processes, and I fail to see how a channel would be distinguished from a process like the ones we have now. Am I missing anything?<br>
<br>best regards,<br>Vlad<br><br>