FAQ terminology harmonisation

Joe Armstrong joe@REDACTED
Tue Apr 1 15:10:22 CEST 2003

On Tue, 1 Apr 2003, Ulf Wiger wrote:

> On 1 Apr 2003, Bjorn Gustavsson wrote:
> >Actually, we think that Erlang being a functional language
> >have scared too many programmers, so we plan some radical
> >changes.
> And about time too! I've suffered through 11 years of
> traditional erlang programming waiting for this!


  Another improvement - which I've  long awaited is to remove send and
receive (since  they are redundant) -  the enclosed code  shows how to
send a message between two processes *without* using send and receive.

Here's a trace

1> c(send).
12> send:demo(hello).
Sending :hello to <0.70.0>
<0.70.0>: received:hello

  Observe that no  send or receive is used  only the more intuitively
understandable method of remote polling of the process dictionary with
process_info(Pid, dictionary) -

  Unfortunately this code has a busy wait - so we'll have to ask Björn and
co to add a few more primitives, probably

	on_put(Pid, Key, Fun)

meaning evaluate Fun() when Pid does put(Key, Val) 


----------- cut -----------------------



demo(Term) ->
    Self = self(),
    Pid = spawn(fun() -> receiver(Self) end),
    io:format("Sending :~p to ~p~n",[Term, Pid]),
    new_send(Pid, Term),
new_send(Pid, Term) ->
    put({to,Pid}, Term).

receiver(From) ->
    Value = new_receive(From),
    io:format("~p: received:~p~n", [self(), Value]).

new_receive(Pid) ->
    {dictionary,D} = process_info(Pid, dictionary),
    case check_dictionary(self(), D) of
	{ok, Val} ->
	error ->

check_dictionary(S, [{{to,S},Term}|_]) ->
    {ok, Term};
check_dictionary(S, [_|T]) ->
    check_dictionary(S, T);
check_dictionary(S, []) ->

sleep(N) ->
	after N ->


More information about the erlang-questions mailing list