[erlang-questions] Bug ?!

Richard Carlsson <>
Mon Oct 2 10:09:09 CEST 2006


datacompboy wrote:
> Is that a bug of compiler?
 >
>   receive
>     {msg, X#x.a} -> ok
>   after 0 -> ok
>   end.
> 
> We got "illegal pattern" on {msg, X#x.a}.

This is not a bug. "X#x.a" cannot be used as a pattern.
The following should work, though:

   receive
     {msg, Y} when Y == X#x.a -> ok
   after 0 -> ok
   end.

	/Richard




More information about the erlang-questions mailing list