On 10/23/07, <b class="gmail_sendername">Alan Sobel</b> &lt;<a href="mailto:alansobel@earthnet.net">alansobel@earthnet.net</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - there was a post a while back on this list about implementing<br>actors in Ruby;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I&#39;d be interested in hearing more about that as well.<br></blockquote></div><br>I did a simple Actor implementation on top of the Fibers mechanism in Ruby 
1.9.&nbsp; You can check it out here:<br><br><a href="http://pastie.caboo.se/97050">http://pastie.caboo.se/97050</a><br><br>Here&#39;s a quick demo of it in use:<br><br><a href="http://pastie.caboo.se/pastes/97049">http://pastie.caboo.se/pastes/97049
</a><br><br>This will define actor1 and actor2.&nbsp; Provided you have a build of Ruby 1.9 sitting around, you can send messages to them like this:<br><br>actor1 &lt;&lt; :cat<br>actor1 &lt;&lt; &quot;A string&quot;<br>actor2 &lt;&lt; :cat
<br>actor2 &lt;&lt; :dog<br><br>This implementation works by adding a mailbox to Fibers, as well as a receive method that takes a filter set (similar to Erlang).&nbsp; When you call receive, it scans over all messages in the mailbox, and if none match, the Fiber yields and lets others run.
<br><br>I later found this, which is quite a bit more developed:<br><br><a href="http://rubyforge.org/projects/concurrent/">http://rubyforge.org/projects/concurrent/</a><br><br>This uses its own thread-based scheduler and runs on top of Ruby 
1.8.<br><br>-- <br>Tony Arcieri<br>ClickCaster, Inc.<br><a href="mailto:tony@clickcaster.com">tony@clickcaster.com</a><br>720-227-0129 ext. 202