[erlang-questions] Ideas for a new Erlang

Hynek Vychodil vychodil.hynek@REDACTED
Thu Jul 3 11:31:23 CEST 2008

On Thu, Jul 3, 2008 at 10:00 AM, Mats Cronqvist <mats.cronqvist@REDACTED>

> Sven-Olof Nystr|m wrote:
> > Mats Cronqvist writes:
> >  > > Selective receive is complex and unnecessary.
> >  > >
> >  >   over the years i've worked with perhaps 300 erlang programmers,
> >  > pretty much all of which have been less accomplished computer
> scientists
> >  > than Sven-Olof. and there are many things in Erlang that they've found
> >  > complex, unnecessary, or both. the syntax, higher order functions,
> list
> >  > comprehensions, recursion, bignums... pretty much everything in
> Erlang/OTP.
> >  >   everything, that is, except two things; selective receive and hot
> code
> >  > loading. i can't think of anyone that has found these two things
> complex
> >  > and unnecessary.
> >
> > I guess we'll have to differ on that point.
> >
> > I've met many people, who even after having quite a bit of experience
> > with Erlang had trouble answering simple questions such as: if a
> > receive matches many patterns, say
> >
> > receive
> >     {foo, X} -> ... ;
> >     {bar, Y} -> ...
> > end
> >
> > and there are messages in the mailbox matching both patterns, which
> > clause and which message is selected?
>   so selective receive is complex, because you've met people who cannot
> immediately answer trivia questions about it? sounds pretty weak.
>  let me suggest that the people you refer to simply used receive, and
> since it did what they expected, they never had to look up the
> description of the semantics. that is, it is the opposite of complex.

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 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.

length(L) -> length(L, 0).
length([_|R], N) -> length(R, N+1);
length([], N) -> N.

Little baby use similar algorithm for tidy up mess.

tidy_up([OneThing|RestOfMess]) -> tidy_up(OneThink), tidy_up(RestOfMess);
tidy_up([]) -> hurray;
tidy_up(Any) -> store_in_proper_place(Any).

Selective receive is familiar for me in same manner, It is recursive and
simple too.

(Notice that this algorithm works properly on deep list too.)

> >  >  now Sven-Olof is obviously entitled to his opinion
> >
> > thanks :-)
>   ...even when it's wrong.
>  what i don't understand is why you spend all this energy trying to
> change the language in this way. there are already lots of languages
> that are easy to reason about and has no users...
>  mats
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080703/f53a5e0e/attachment.htm>

More information about the erlang-questions mailing list