If I try to use an undefined variable, the compiler will give out an error saying there is no function/0 defined. It is trying to parse the variable as a 0-arity function.
== Compilation error on file lib/x.ex ==
** (CompileError) lib/x.ex:36: function somevariable/0 undefined
(stdlib) lists.erl:1337: :lists.foreach/2
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
This makes the programmer think at first that there is a problem with a function.
Is there any way to give a friendlier error message? Suggestion: if the compiler can't find a null-arity function, add to the message:
"This might be an undefined variable called xxxx".
If I try to use an undefined variable, the compiler will give out an error saying there is no function/0 defined. It is trying to parse the variable as a 0-arity function.
== Compilation error on file lib/x.ex ==
** (CompileError) lib/x.ex:36: function somevariable/0 undefined
(stdlib) lists.erl:1337: :lists.foreach/2
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
This makes the programmer think at first that there is a problem with a function.
Is there any way to give a friendlier error message? Suggestion: if the compiler can't find a null-arity function, add to the message:
"This might be an undefined variable called xxxx".