Hi again, if you are still interested, I found another hacky fix in JS. 
Instead of having to call the printST() twice, I could just use 
arguments.callee to pass to Error.captureStackTrace(). The printST() now 
become as simple as this:

function printST(bl) {
var obj = {};
Error.captureStackTrace(obj, arguments.callee);
log('\tStack length: ' + obj.stack.length);
}

I don't know how it works, but my theory is that there are some special 
internal variables attached to arguments that makes it work. I checked, 
printST === arguments.callee is true but some how using arguments.callee 
instead of direct function name make a whole lot difference.
Another side detail, that fix didn't just come out of the sky, I saw it in 
callsite <https://github.com/visionmedia/callsite/blob/master/index.js#L6> 
module 
of TJ Holowaychuk. I thought I should give it a try, and it magically 
works. Somehow he had thought it through and come up with the beautiful 
solution. My hat's off to him. This bug also affect stack-trace 
<https://github.com/felixge/node-stack-trace> module of Felix Geisendörfer 
but I don't have enough confidence to send him a PR. May be I will just 
send him an Issue.
You don't need to answer this. I just found something interesting and I 
thought maybe you would want to know.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/16211394-e025-4c62-94dd-cf89e84d4b2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to