Hacker News new | past | comments | ask | show | jobs | submit login

Sometimes Erlang standard library code is not the prototypical Erlang development code. For example file_open() is a library function returning an error tuple since it is one of the obvious results file_open() will return.

Now in your code it depends on what you expect or what your guarantees are. If this is a library that expects to open a config file to that is always there, well then a match is better and if it doesn't work an exception is thrown, report written and maybe your process gets restarted.

But now imagine your are writing a configuration file parser. Now you code acts like a library so the input file not being there is a common case and maybe code above needs to decide if it should blow up or not on it.

Anyway that is my amateurish understanding of it. Maybe someone who knows more can chime in and correct me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: