[erlang-questions] receive doesn't work well in shell

Richard Carlsson <>
Sat Apr 21 20:36:06 CEST 2007


June Kim wrote:
> 5> receive V->V end.
> 4
> 6> P!4.
> 4
> 7> receive V->V end. %% it blocks here, where I expected "5" immediately.
> ==================
> 
> Why does the receive block on the input line 7? What's different to
> calling test1:get/0?

The second time you use V in the pattern, it's already bound to 4.
Hence, it can't ever match 5, and the receive won't terminate.

    /Richard



More information about the erlang-questions mailing list