|
|
|
|
|
by simoncion
3747 days ago
|
|
"It returns the exception so you can do something like case catch Expression of"
Something to be aware of is the cost of a bare catch when an exception of type 'error' is thrown:"[W]hen the exception type is 'error', the catch will build a result containing the symbolic stack trace, and this will then in the first case [1] be immediately discarded, or in the second case matched on and then possibly discarded later. Whereas if you use try/catch, you can ensure that no stack trace is constructed at all to begin with." [0] Stack trace construction isn't free, so it makes sense to avoid it if you're not going to use it. I know that in either Erlang 17 or Erlang 18, parts of Mnesia were slightly refactored to move from bare catch to try/catch for this very reason. [0] http://erlang.org/pipermail/erlang-questions/2013-November/0... [1] He's referring back to an example in the email |
|