The trace operation
Purpose
The trace operation in Pile is a simple yet powerful debugging tool designed to provide quick feedback during development. It serves as a "value checker" that helps identify potential issues in your program by outputting the current value on top of the stack to the console.
Usage
The trace operation outputs the value at the top of the stack, allowing you to verify intermediate states in your program. Here's how it works:
- The value at the top of the stack is displayed.
- The stack remains unchanged (no items are popped).
Examples
"This is concatenated with " trace
# The previous text is still on the stack, that's why it is possible to concatenate now
"This text" +
1 1 + trace
# Output: int 2
# Stack: [ 2 ]