[erlang-questions] Trouble with Erlang's lenient comparisons

JohnyTex ekeroth.christoffer@REDACTED
Wed Apr 13 11:08:45 CEST 2011


Hello! :)
I'm a newbie Erlang programmer, and I've really liked my experience so
far. However, I've made mistakes related to Erlang's type system a
couple of times now, more specifically the fact that you can compare
different types with each other without Erlang complaining.

I've inherited someone else's code base; sometimes I forget that a
function returns a tuple and I up comparing it with an integer or
similar, and get weird behaviour and hard-to-find bugs as a result.

What's the best way to prevent this? I will try writing some unit
tests later today with EUnit, and I'm generating PLTs for Dialyzer as
I write this, but I was wondering if there are any other tools or
"best practices" that could help me to write more "type safe" code?

Thanks in advance! :)



More information about the erlang-questions mailing list