FYI escript gotcha wrt receive

Anthony Shipman als@REDACTED
Thu Sep 9 18:56:52 CEST 2010


I had an escript that spawned a process to run a receive loop to fetch 
messages. The messages were returned by the receive in a scrambled order wrt 
the sending process. I found the cause and solution buried deep.

The erl_eval module page has this at the bottom:
    Bugs
        The evaluator is not complete. receive cannot be handled properly
and the escript page says
    By default, the script will be interpreted. You can force it to be 
    compiled by including the following line somewhere in the script file:

    -mode(compile).        

Using compile mode solved the receive problem. I think that it would be useful 
for the escript page to say why one would want to use compile mode instead of 
interpret.

-- 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.


More information about the erlang-questions mailing list