[erlang-questions] feedback please

zxq9 <>
Thu Sep 24 07:23:28 CEST 2015


On Thursday 24 September 2015 07:13:15 Roelof Wobben wrote:
> Thanks for the feedback.
> 
> I understand the code and I see you use error handling. That Is the next 
> chapter I need to study.
> So after that chapter I can change it to the code you build.  But L like 
> the way to handle the input a lot.

That was an example of match-or-crash as error handling. Any place that code would have crashed is a place there wasn't a match, which meant something deeper than our expected input case was faulty -- and in that case it is better to stop execution and crash completely than carry on with crazy data or a screwed up underlying runtime.

If the next chapter covers "error handling" it probably talks about how crashes are dealt with (and the link/monitor messages that are sent whenever a process crashes/exits) and how to use `try.. catch` to handle exceptions without crashing. There aren't very many places you will want to use try..catch (many folks make a point of trying very hard not to use it, myself included), but it is important to know.

Have fun!
-Craig


More information about the erlang-questions mailing list