<br><br><div class="gmail_quote">On Thu, Jul 3, 2008 at 10:00 AM, Mats Cronqvist <<a href="mailto:mats.cronqvist@gmail.com">mats.cronqvist@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Sven-Olof Nystr|m wrote:<br>
</div><div class="Ih2E3d">> Mats Cronqvist writes:<br>
> > > Selective receive is complex and unnecessary.<br>
> > ><br>
> > over the years i've worked with perhaps 300 erlang programmers,<br>
> > pretty much all of which have been less accomplished computer scientists<br>
> > than Sven-Olof. and there are many things in Erlang that they've found<br>
> > complex, unnecessary, or both. the syntax, higher order functions, list<br>
> > comprehensions, recursion, bignums... pretty much everything in Erlang/OTP.<br>
> > everything, that is, except two things; selective receive and hot code<br>
> > loading. i can't think of anyone that has found these two things complex<br>
> > and unnecessary.<br>
><br>
> I guess we'll have to differ on that point.<br>
><br>
> I've met many people, who even after having quite a bit of experience<br>
> with Erlang had trouble answering simple questions such as: if a<br>
> receive matches many patterns, say<br>
><br>
> receive<br>
> {foo, X} -> ... ;<br>
> {bar, Y} -> ...<br>
> end<br>
><br>
> and there are messages in the mailbox matching both patterns, which<br>
> clause and which message is selected?<br>
<br>
</div> so selective receive is complex, because you've met people who cannot<br>
immediately answer trivia questions about it? sounds pretty weak.<br>
let me suggest that the people you refer to simply used receive, and<br>
since it did what they expected, they never had to look up the<br>
description of the semantics. that is, it is the opposite of complex.<br>
<div class="Ih2E3d"></div></blockquote><div><br><span class="vcb_m"> </span>I agree with you. Selective receive is very familiar for me. I do it every day. Every day messages comes to my mailbox and every day I do selective receive. Every day mails arrives to <span class="vcb_rt"></span><span class="vcb_rt"></span>my mail box, mails from people what I love, ones from people what I like, ones from people what I hate, ones important, ones not important and spam. Every day I do exactly same think as Erlang do. I give mail by mail and check it against patterns and do something with it immediately, or push it to some queue or storage, or ignore (don't receive and leave untouched in mailbox). May be not it is efficient but very familiar to me. I don't know how to handle with channels. May be because I'm not plumber :-) I love Erlang because it do thinks very familiar to me, not only mail box handling but almost everything. For example recursion. How little baby learn count think. On start you know count in nothing. Take first think and increase counter by one and do this step again until all thinks done, than return result.<br>
<br>length(L) -> length(L, 0).<br>length([_|R], N) -> length(R, N+1);<br>length([], N) -> N.<br><br>Little baby use similar algorithm for tidy up mess.<br><br>tidy_up([OneThing|RestOfMess])<span class="vcb_rt"></span> -> tidy_up(OneThink), tidy_up(RestOfMess);<br>
tidy_up([]) -> hurray;<br>tidy_up(Any) -> store_in_proper_place(Any).<br><br>Selective receive is familiar for me in same manner, It is recursive and simple too.<br><br><br>(Notice that this algorithm works properly on deep list too.)<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
> > now Sven-Olof is obviously entitled to his opinion<br>
><br>
> thanks :-)<br>
</div> ...even when it's wrong.<br>
<br>
what i don't understand is why you spend all this energy trying to<br>
change the language in this way. there are already lots of languages<br>
that are easy to reason about and has no users...<br>
<font color="#888888"><br>
mats<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil