Actors with Multi-Headed Receive Clauses
От: thesz Россия http://thesz.livejournal.com
Дата: 05.06.09 15:39
Оценка:
http://sulzmann.blogspot.com/2008/10/actors-with-multi-headed-receive.html

Here's a simple example of a market-place actor

receive
  Seller x, Buyer x -> "match found"

We employ the combination of multiple messages in a receive pattern and non-linear patterns to test for a matching seller and a buyer. Non-linear patterns are in fact a short-hand for guards. That is, the above is equivalent to

receive
  Seller x, Buyer y when x == y -> "match found"


Получается своего рода ассоциативная память, позволяющая делать весьма разветвлённые dataflow сети.
Yours truly, Serguey Zefirov (thesz NA mail TOCHKA ru)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.