[erlang-questions] Advanced Erlang Subtleties

Richard Carlsson <>
Fri May 20 14:34:45 CEST 2011


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