[erlang-questions] Bug ?!

Bengt Kleberg bengt.kleberg@REDACTED
Mon Oct 2 09:11:50 CEST 2006


On 2006-10-02 05:27, datacompboy wrote:
> Is that a bug of compiler?
> 
> -module(a).
> -record(x, {a, b, c}).
> -export([bug/1]).
> 
> bug(X) ->
>   receive
>     {msg, X#x.a} -> ok
>   after 0 -> ok
>   end.

the notation X#x.a is (after the pre-processor has pre-processed it) a 
function call. you are not allowed function calls in the receive 
statement. ie, this is (also) wrong:

bug(X) ->
   receive
     {msg, func(X)} -> ok
   after 0 -> ok
   end;

func(_X) -> ok.


bengt
-- 
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list