global_name_server question.

Claes Wikstrom klacke@REDACTED
Wed Jun 2 22:37:21 CEST 1999


> 
> Folks,
> I'd have another dumb question about "registered" process.

> receiver() ->
>      receive
>          Message ->
> 	     io:format("Recv: ~w~n", Message),
> 	     receiver()
>      end.


Should be 
io:format("Recv: ~w~n", [Message]),

This is really irritating that io:format/2 doesn't
fail when presented with unformatable data.
It simply fails to write anything and returns 
an error code.

A very good practice is to start to write
ok = io:format(.....

everywhere in the code, the match then works as an
assertion and the process will crash when io:format/2
returns an error code.


> (server@REDACTED)16> eh!{boo, baa, foo, bar,42}.
> {boo,baa,foo,bar,42}

Ahhh, but this is not the printout, this is the
return value from the sendstatement that is printed in
the shell, where is the "Recv .... " ??

/klacke



More information about the erlang-questions mailing list