1

I've been working through the Erlang tutorials in Seven Languages in Seven Weeks using Erlide for eclipse and for the most part all seemed to be ok until i got to the concurrency section.

In this section, the author walks through a simple example

loop() ->  
    receive
        "casa" ->  
                io:format("house~n"),
                loop();
        "blanca" -> 
                io:format("white~n"),
                loop();

        _ -> io:format("no comprendo~n"),
                loop()
    end.

When running as suggested by the book i should be able to send messages with Pid ! "someStuff". However when running this, nothing is returned and the debugger requires i kill the process before any activity resumes.

Here's an example of the console. You'll see when i send the message, nothing is returned.

Eshell V5.10.4
(ErlangDay3@Jeff-PC)1> Pid = spawn(fun translate:loop/0).
<0.202.0>
(ErlangDay3@Jeff-PC)2> Pid ! "casa".
Pid ! "hello?".
WhatJustHappened.

This all seems to run perfectly through the command line directly with Eshell (without eclipse and erlide). Could i have missed some configuration somewhere? I'm now completely stumped. I realize that maybe SO is not the best place for a question like this, however i've completely exhausted my google-fu and it doesn't appear that erlide has any forum presence.

Thanks for any and all advice.

In case it helps anything i'm running windows 7 and eclipse (STS, 3.3.0), with Erlang 5.10.4 (R16B03-1)

Beta033
  • 1,975
  • 9
  • 35
  • 48
  • As you say the code is correct, to help to distinguish between a problem of execution/invocation and a problem of output (there some funny things in erlang around io:format and group_leader) I suggest you to add a third message like the atom `stop` where you don't call back `loop()` and simply return the atom `stopped`. If you can stop the process using `Pid ! stop`, then you should dig in the group_leader direction. – Pascal Mar 17 '14 at 04:22
  • Thanks. I just tried this, the eshell stops responding. however when i start an eshell from the console and perform my test the same way, all works as expected (sending stop, stops. sending others return the appropriate response). I'm thinking the problem is somewhere in erlide as this works fine from a console shell. – Beta033 Mar 18 '14 at 03:42

1 Answers1

1

Thanks for the report!

This was a bug that I was hunting unsuccessfully since a while back, but now I managed to find and fix it. Please try the latest nightly build from http://download.erlide.org/update/nightly

Vlad Dumitrescu
  • 931
  • 5
  • 11