[erlang-questions] An Erlang 101 question
Thu Jul 16 21:02:58 CEST 2015
I have several functions that look like this:
Result = dets:lookup(?contacts, Email),
The implication is that the function returns and empty list, , if it fails to find a record, otherwise it returns a list containing the record.
This makes it easy to distinguish the failure-to-return a record condition, but means that every function that depends up on get_contact/1 needs to do so and know what to do in that case. But that begins to feel like defensive programming.
I can see several ways of dealing with this problem, but it occurs to me that there must be a conventional approach. What might be... what?
More information about the erlang-questions