Q&A highlight
Posted4 months agoActive4 months ago
Ask HN: How to trace a void recursive function?
programmingrecursioncomputer science
Ask HN: How to trace a void recursive function?
No synthesized answer yet. Check the discussion below.
Discussion (4 comments)
Showing 4 comments
The common answer is a stack trace. In JavaScript you can get that any time and any where with:
new Error().stack;
Stack traces lose their helpfulness in applications with high frequency network traffic because the network buffer will likely not be the start of flow control but a stack trace cannot run deeper than that.I realized I do not understand how function calls use stack (exactly and accurately I mean I can imagine some stack push pop happening). Any guidance for resources? I seeked in google but turns out most materials are related to assembly language programming which I have no idea about.
4 months ago
A stack trace just lists the steps an application went through by calls to non primitive references. This varies pretty significantly by language. An item in the stack is a step in memory. That is about as much as I know.
4 months ago
// new Error().stack;
or just console.trace()
View on Hacker NewsHN ID: 45100360