<div>Dynamic typing also helps a lot with Erlang style message passing. If you want to see a statically typed language with almost-Erlang-like message passing, check out Phillip Wadler's Links.</div><div><br></div><div>
Erlang-style selective receive can't be done in Links (because its receive statement must exhaustively cover all patterns in order to type-check). In order to get similar functionality in a static typing environment, message passing must be replaced with a more complicated concurrency paradigm like join-calculus.</div>
<div><br></div><div>Also, message passing complicates the typing system. Functions have a more complicated type (instead of A -> B... A ~ C -> B... which means the function can receive a message of type C while executing). All other statements have an implicit message type which depends on the context of the statements around it. It gets harder for the programmer to mentally type-check the program.</div>
<div><br></div><div>Another issue with static typing arises when handling process death. Monitoring a process would require the type of the reason to match up with the code receiving the {'EXIT',...} message. So, every process is of type process (m, d)... where m is the type of message it can receive, and d is the type of the death reason. You would link() would only be able to called from process (a, _) onto process (_, a). It's restrictive.</div>
<div><br></div><div>Anyway, I like static typing, but these issues would have to get solved. They are necessarily simple.</div><div><br><div class="gmail_quote">2008/10/21 Robert Virding <span dir="ltr"><<a href="mailto:rvirding@gmail.com">rvirding@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I think a lot of confusion here among different issues:<br><br>- Erlang is strongly typed, you cannot get around the type system and functions complain (generate exceptions) when they don't get the right types<br>
- It is, however, dynamically typed and not statically typed in that the types are checked at run time and not at compile time<br>
- If you deem the documentation and function arguments/returns to be confusing this has absolutely nothing to do with typing, whether strong, weak, static or dynamic.<br><br>That it is dynamically typed really does help with hot code loading. Otherwise you either have static and unchangeable module interfaces or you could get a system which is *really* unsafe, a function is called with one data type and thinks it is getting another and doesn't check as it knows the compiler has checked. Distribution makes this problem worse.<br>

<br>I will freely admit that some of the functions don't always have intuitive arguments, are inconsistent or otherwise don't uphold the principle of least surprise. One reason for this is that the system evolved rather freely over time and many things (useful) things were just added to the system without much consideration for consistency and such. And, as everyone who has tried, knows changing things afterwards is *not trivial*.<br>

<br>Robert<br><br><div class="gmail_quote">2008/10/21 Steve Davis <span dir="ltr"><<a href="mailto:steven.charles.davis@gmail.com" target="_blank">steven.charles.davis@gmail.com</a>></span><div><div></div><div class="Wj3C7c">
<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div>On Oct 21, 9:45 am, Rapsey <<a href="mailto:rap...@gmail.com" target="_blank">rap...@gmail.com</a>> wrote:<br>
> I don't understand. What does this have to do with the language being<br>
> strongly typed?<br>
<br>
</div>Well, the way I think about it is that types let you define what the<br>
function expects, and what you can expect in return. So it would<br>
provide a contract or agreed protocol in a far more cohesive way that<br>
is possible right now in erlang (cf. "spec" and "record"). Types would<br>
speed up coding as it would avoid you having to dig around in every<br>
function's source to see what you should expect in return. There's<br>
probably some fatal flaw in this thinking -- which is why I asked the<br>
question :)<br>
<font color="#888888"><br>
/s<br>
</font><div><div></div><div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div></div></div><br>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div>