<br><br><div><span class="gmail_quote">2007/11/4, Dennis Byrne <<a href="mailto:dbyrne@thoughtworks.com">dbyrne@thoughtworks.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br><font face="sans-serif" size="2">Hello Ulf,</font>
<br>
<br><font face="sans-serif" size="2">If you have a function that is 100%
predictable, couldn't there be some serious performance gains given that
the function is frequently passed the same message?  In other words,
why put a core to work calculating the result you gave last time someone
sent you a given message?  It would be better to use this function
to spawn a process that could use the process dictionary as a cache (one
that would never expire).  </font>
<br>
<br><font face="sans-serif" size="2">Unless ... are gets and puts to the
dictionary thread safe?</font>
<span class="q"><br><font face="sans-serif" size="2"></font></span></blockquote></div><br>Hmm, these are two different questions.<br><br>The immutability part means that stuff like this is not possible in Erlang:<br><br>
<pre>void foo( int &i )<br>{<br>    i++;<br>}<br><br>int main()<br>{<br>    int bar = 5;   // bar == 5<br>    foo( bar );    // bar == 6<br>    foo( bar );    // bar == 7<br><br>    return 0;<br>}</pre><br>(from <a href="http://developer.kde.org/~wheeler/cpp-pitfalls.html">
http://developer.kde.org/~wheeler/cpp-pitfalls.html</a>, one of many web pages listing C++ pitfalls).<br><br>The fact that a function will return the same value every time it is called with the same input, doesn't mean to imply that you have to call it every time you have a certain set of values. (-: 
<br><br>It's not a matter of efficiency. It's rather a sanity thing. When you debug functional code, it takes only moments to determine that a function depends only on its input parameters. Once you've done that, you can figure out what it does, and rest assured that this will always hold.
<br><br>BR,<br>Ulf W<br>