On 8/10/07, <b class="gmail_sendername">Michael Vanier</b> &lt;<a href="mailto:mvanier@cs.caltech.edu">mvanier@cs.caltech.edu</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;">
Just to get the history right: garbage collectors have been around a _long_ time, since the &#39;60s in<br>Lisp systems.&nbsp;&nbsp;They only became known to most programmers through Java (which is one unarguable good<br>thing that Java did).
</blockquote><div><br>Ah interesting :-)<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">As for threading, in addition to Haskell&#39;s approach you might also look at Erlang, which has a quite
<br>different (and quite interesting) approach to the whole problem.&nbsp;&nbsp;I wonder if anyone has tried to<br>implement a message-passing style of concurrency in Haskell.<br></blockquote></div><br>Erlang message passing rocks :-)&nbsp; I&#39;d love to see this working in Haskell.
<br><br>Note that Erlang&#39;s message passing is not perfect.&nbsp; Specifically, there is zero type or parameter checking.&nbsp; It will quite happily let the following compile:<br><br>% initialization routines etc go here<br>% ...
<br><br>% ping thread. this sends messages to pong<br>ping() -&gt;<br>&nbsp;&nbsp; pong ! hello,<br>&nbsp;&nbsp; pong ! hello,<br>&nbsp;&nbsp; pong ! {hello},&nbsp;&nbsp; % this does not throw a compile error<br>&nbsp;&nbsp; pong ! hello,<br>&nbsp;&nbsp; io:format(&quot;ping done~n&quot; ).
<br><br>% pong thread, this listens for messages from pong<br>pong() -&gt;<br>&nbsp;&nbsp; receive<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hello -&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; io:format(&quot;pong received hello~n&quot;),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pong()<br>&nbsp;&nbsp; end.<br><br>You can see that sending the tuple {hello} does not cause a compile time error (or even a runtime error for that matter), even though pong does not have a valid pattern for receiving it.
<br><br>Now, arguably the fact that we are pattern matching on the receiver at least means we dont do anything with the invalid data sent, but this is not rocket science: the standard technique to ensure decent compile time validation in rpc-type things is to use an interface.
<br><br>The interface defines the method names and parameters that you can send across.&nbsp; Both the receiver and the sender have access to the interface definition, and it is trivial to check it at compile time.<br><br>(Caveat: havent looked enough into Erlang to know if there is a good reason for not using an interface?)
<br><br>