printStack (--)
Inputs
- None.
Outputs
- None.
printStack prints the current data stack without modifying it.
Behavior
- The current data stack is printed from bottom to top.
- Each stack item is formatted in the formatter's canonical representation and printed on its own line.
Notation
A known value is printed as a literal (5, "t", TRUE, (1 2), a multi-line Dict with one name: value; per field); an unknown value is printed as its schema name (Int32, Text). A Ref is printed as its target's value or schema followed by Ref for a mutable reference or Cref for an immutable one: x: 5; gives 5 Cref for x and 5 Ref for @x. A known NIL reference is printed as NIL or CNIL after the target schema, so Int32 Ref prints as Int32 CNIL; in a formatted Dict a private field has private after its value or schema, before the semicolon; a NIL Code prints its signature followed by CNIL ({} () {} codeRef CNIL). A Block is printed as its source position: «test.mpl» 3 3 Block.
Example
{} 0 {} [
"-- original stack --" printCompilerMessage
7 "hi" FALSE
printStack
"-- printStack does not pop --" printCompilerMessage
printStack
"-- after one manual pop --" printCompilerMessage
_:;
printStack
_:; _:;
0
] "main" exportFunction
Expected Output During Compilation
-- original stack --
7
"hi"
FALSE
-- printStack does not pop --
7
"hi"
FALSE
-- after one manual pop --
7
"hi"
See also
failCompilationbuiltin(--)Aborts compilation immediately.getCallTracebuiltin(-- callTrace)Returns a Ref to the current call trace, orNILwhen unavailable.printCompilerMessagebuiltin(message --)Prints a known Text message during compilation and appends one line-feed character.printStackTracebuiltin(--)Prints the current scope stack as file path, line, column, and node source text information.raiseStaticErrorbuiltin(message --)Raises a compile-time error with the given known Text message.