Avatar_small Nicholas H.T... 3 posts

Hi,

Nice screencasts… I’ve just been watcing ep1 on my daily commute into work and have spotted an omission.

In message_router:route_messages/0

route_messages() ->
    receive
    {send_chat_msg, Addressee, MessageBody} ->
        Addressee ! {recv_chat_msg, MessageBody},
        route_messages();
    {recv_chat_msg, MessageBody} ->
        io:format("Received: ~p~n", [MessageBody]);
    shutdown ->
        io:format("Shutting down~n");
    Oops ->
        io:format("Warning! Received: ~p~n", [Oops]),
        route_messages()
   end.

Notice the (recv_chat_msg, MessageBody) clause doesn’t have the tail call to route_messages… so when it matches the process just ends rather than loop back on itself. The omission is in the screen-cast and the source code. It looks like you think it should be doing this tail call as you appear to attempt to call stop/1 on the process that received the chat message (which had already ended as it fell through).

Just thought you might want to know.

Nicholas.
ntoll.org

 
Alain_o_dea_small Alain O'Dea 35 posts

Good point. A little spoiler note: that error is deliberate. Watch screencast 2 for the resolution.

 
Avatar_small Nicholas H.T... 3 posts

Well, I watched episode two this morning on the train. All I can say is that I’m pleased I was paying such close attention during episode one. :-)

3 posts, 2 voices