[erlang-questions] Erlang and the learning curve

Joe Armstrong erlang@REDACTED
Tue Jan 4 15:00:28 CET 2011


On Tue, Jan 4, 2011 at 2:12 PM, Henning Diedrich <hd2010@REDACTED> wrote:
> 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.

I use the following rule - find the line number of the first error message
totally ignore the text that is printed - say to yourself "there is
something wrong with this line"
mess with the line until the error goes away.

This method works for all know languages and environments
(with the exception of eclipse, where I gave up after days of trying to
find out what some error message meant)

/Joe


> 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