[erlang-questions] Erlang and the learning curve

Henning Diedrich hd2010@REDACTED
Tue Jan 4 14:12:02 CET 2011


Hi Joe,

On 1/4/11 10:17 AM, Joe Armstrong wrote:
> Image you're new to C and write this
>
> int add(int a; int b){
>    return a+b;
> }
>
> gcc says
>
> test3.c:1: error: parameter ‘a’ has just a forward declaration
> test3.c: In function ‘add’:
> test3.c:2: error: ‘a’ undeclared (first use in this function)

Pretty convincing. In the literal sense, before I read this I may have
insisted Erlang error messages are particularly confusing.

This example demonstrates that I was probably really just comparing
beginner error's error messages with 'advanced error' error messages,
including how you try to interprete them. Likely some of the
notoriety of Erlang error messages come from that.

That said 'no match of right hand side' could STILL be formulated in
a more newbie friendly way. It should be possible and would be a
good service to mankind to make the extra effort for the feeble.
It's really only a handful of error messages that could be changed
to make a big difference.

C did not always have "first use in this function" hints, that was
a helpful later addition.

Henning


More information about the erlang-questions mailing list