[erlang-questions] Advanced Erlang Subtleties

James Churchman jameschurchman@REDACTED
Fri May 20 16:54:59 CEST 2011


Very interesting and makes a lot of sense.... i was hoping that 'better off pretending you don't know anything about this' was the case and there was not some huge set of optional extra stuff onto of a try catch!

On 20 May 2011, at 13:34, Richard Carlsson wrote:

> On 05/20/2011 01:35 PM, James Churchman wrote:
>> also does anybody know the answer to my :
>>> There is a 3rd parameter in the AST for a catch section in a Try/Catch
>> that is always a match all ( a bit like ERROR_TYPE:ERROR:_ ) does
>> anybody know what this means? is there an extra option in a catch that
>> is rarely used?
> 
> Yes, it's a cheap and compact encoding of the stack trace (as a bignum or binary, I don't remember). This is so that no time is wasted building a symbolic stack trace as a list of tuples that might simply get discarded as soon as the exception is caught, while making it possible to suspend an exception temporarily, drop back into Erlang code to match against a set of catch-patterns, and re-throw the whole thing again if nothing matched. If it's needed for anything, the blob will be unpacked into a symbolic trace.
> 
> All in all, you're better off pretending you don't know anything about this, apart from the fact that effort has been made to keep exceptions as cheap as possible.
> 
>    /Richard




More information about the erlang-questions mailing list