6.24. kink/TRACE

6.24.1. type trace

`trace` is an element of a stack trace.

A `trace` consists of the attributes.

• Sym: a `str` of the sym of the called fun.

• Location: a `location` where the invocation occurred.

• Tail?: a `bool` whether the trace is of a tail-call.

6.24.1.1. Trace.sym

`sym` returns `Sym` of `Trace`.

6.24.1.2. Trace.location

`location` returns `Location` of `Trace`.

6.24.1.3. Trace.tail?

`tail?` returns `Tail?` of `Trace`.

6.24.1.4. Trace.desc

`desc` returns a `str` which describes `Trace`.

If `Tail?` attribute is true, the first part of the result is enclosed by braces like "{...}".

If `Tail?` attribute is false, the first part of the result is enclosed by brackets like "[...]".

Example

6.24.1.5. Trace1 == Trace2

`==` operator, or `op_eq` method, returns whether `Trace1` and `Trace2` have the equal attributes.

Precondition

`Trace2` must be a `trace`.

6.24.2. TRACE.new(Sym Location ...[$config={}])

`new` returns a new `trace`.

Config method:

• C.tail

The result `trace` will have `Sym` and `Location` as the attributes of the same names. If C.tail is called, `Tail?` attribute will be true. If C.tail is not called, `Tail?` attribute will be false.

Preconditions

`Sym` must be a `str`.

`Location` must be a `location`.

Example

6.24.3. TRACE.is?(Val)

`is?` returns whether `Val` is a `trace`.

6.24.4. TRACE.snip

`snip` returns a `trace` with Sym="", Location=LOCATION.empty, Tail?=true.

This `trace` value is used to replace snipped traces of tail-calls.

6.24.5. TRACE.current_traces

`current_traces` returns a `vec` of `trace` values of the stack of the abstract stack machine, from the bottom to the top.

At the tail of `current_traces`, the following sequence of abstract instructions is evaluated: