fn dbg
Debug print (D-7800): writes [file:line] <expr text> = <value> (traceId: <id>) to stderr and returns x, so it can wrap any
sub-expression. Takes and returns x by value; has no effect in the type system (a debugging aid); the prod profile removes
the print (like assert contracts), [profile.<name>] dbg = true restores it.
Example:
fn main() io {
let a = 3
let b = 4
let c = dbg(a + b) * 2
print("c = {c}")
}Output
c = 14
@intrinsic("dbg") pub(api) fn dbg<T>(x: T) -> TComplexity. O(1) plus the cost of showing the value.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
x | T |
Returns
T
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/functions.oxl:181