Janet Notes and Examples
←prev

Debugging

Edit and try this response from bakpakin in gitter:

There is a built in debugger. Running janet -d will enable it. If there is an error or call to debug, you will enter the debugger.

The debugger is just a normal repl with some extra bindings exposed, and the last error and fiber set. You can step through the bytcode.

To set breakpints, use (debug/break) or (debug/fbreak).


The tracev function prints out a value and then returns it.

(foo bar)
# Wait. What value was passed to `foo`?

# Prints out variable name (here, "bar") and its value, then passes
# that to `foo`.
(foo (tracev bar))