[erlang-questions] Bug ?!

Robert Virding <>
Fri Oct 6 23:35:00 CEST 2006

Mats Cronqvist wrote:
> Robert Virding wrote:
>> I believe it is important to keep things clean, consistent and elegant 
>> otherwise you will end up with a language built on exceptions.
>   aha! so that's why this works?
> -define(foo,bla.
> go()->?foo.

As I wrote in the not too distant past here in erlang-questions: macros 
were a joke! Although you may need a slightly warped sense of humour to 
appreciate it.

>   more to the point, i still fail to see how this;
>   receive
>     X#r.a -> do_a();
>   is more unclean, inconsistent and inelegant than this;
>   XRA = X#r.a,
>   receive
>     XRA -> do_a();

If X#r.a is a valid pattern then what does this mean?

f(X#r.a) -> {yes,X}.

It's a valid pattern, so what does it mean?

>   but hey, i'll take richard & richard's word for it.

You don't have to take Richard's word for it, but you should really 
think through your suggestions properly to see their full implications. 
Not just the immediate case in which you are interested.

We don't need more ugly hacks in there!

And I personally think that the following way of writing it is a much 
cleaner and more elegant Erlang:

     XRA when XRA == X#r.a -> do_a();

As Richard pointed out.


More information about the erlang-questions mailing list