inspect
Source locations of running code: backtraces of a strand's calls, and where functions are defined.
Locations come from the debug info that compiled code carries, so code without it has none.
Types
| Type | Description |
|---|---|
Backtrace |
A snapshot of a strand's calls, innermost first. |
Frame |
One call in a Backtrace. |
Location |
A span of source code in a file. |
Functions
definition func -> (Location | nil)
Gives where a Do function is defined.
For a named function or method, the location runs from def through the
name. For a do block, it runs from do through the parameters and return
type, leaving out the body. A bound method, such as
obj.method, gives the location of the Do method it calls.
Gives nil for anything else: a native function or method, an object
callable through a (call) method, or a value that isn't callable.
Parameters
| Name | Type | Description |
|---|---|---|
func |
Value |
Value to look up. |