I am following the book "Professional haXe and Neko" written by Franco Ponticelli and Lee McColl-Sylvester.
Chapter 7-When Things Go Wrong is about errors and exceptions
When I follow the code outlined on pg.192 (which I have minimized here) I have
class CallStack{
public static function main():Void{
var i:Int = 0;
i = multiply(i, 6);
}
public static function multiply(a,b){
return a * traceStack(b);
}
public static function traceStack(a){
var cs = haxe.CallStack.callStack();
trace(haxe.CallStack.toString(cs));
return a;
}
}
When I compile this code it returns an empty callStack.
According to the haXeAPI the callStack() function "Returns the call stack elements, or an empty array if not available."
So my questions are these,
Why wouldn't the stack elements be available?
What else would cause the callStack function to return an empty Array?
Is there a better method to use to retrieve this information?