[erlang-questions] Re: What about making sense?

David Mercer dmercer@REDACTED
Mon Feb 22 16:05:43 CET 2010


On Saturday, February 20, 2010, Joe Armstrong wrote:

> When I write *any* process I always start with something like:
> 
> loop(...) ->
>     receive
>          Any -> io:format("got:~p~n",[Any]),
>          loop(...)
>    end.

Out of curiosity, why do you start with that and not:

	-behaviour(gen_server).

	init(_) -> {ok, []}.

	handle_info(Info, State) ->
		io:format("got:~p~n",[Info]),
		{noreply, State}.

Obviously, the semantics are different and all, but I'd have thought if I
were creating a process, I may as well make it a gen-server process so I
don't have to retrofit it into that framework later.

Cheers,

David



More information about the erlang-questions mailing list