I’ve been spending a lot of time recently tinkering with different constructs and methodologies in Javascript, and one of the most fascinating things I’ve come across is Spencer Tipping‘s use of continuation-passing style.
It’s ok if you aren’t familiar with CPS, but I think anyone hoping to make the cognitive leap to functional programming should study it. As a bare miniumum, you need to know that a continuation is:
[a reification of] an instance of a computational process at a given point in the process’s execution
Continue reading →
I started a Javascript Stacktrace project back in August 2008. The idea was to give additional debugging power to browsers where you don’t have good tools to work with. I’d like to give you an update on where the project is today.
Lately, I’ve been working on updating my old script. Since it was written, we’ve seen lots of major browser releases and the introduction of the V8 Javascript engine used by Google Chrome.
Updated browser compatibility
Browsers that are fully-supported and well-tested:
- Firefox (and Iceweasel) 0.9+
- Safari 3+
- IE 5.5+
- Konqueror 3.5+
- K-Meleon 1.5.3+
- Epiphany 2.28.0+
Browsers that are supported in almost all cases but not as well-tested:
- Chrome 1+ – One bug (feature?) that may be in Chrome reporting functions as anonymous when they aren’t. HOWEVER, Chrome’s stack gives us line numbers AND column numbers, so we can see exactly where our problem is – even in minified Javascript! Sweet!
- Opera 9+ – Opera is dead to me now. Opera 10+ has removed the error.stack info we needed and introduced error.stacktrace, but it seems very unstable.
More info about compatibility can be shown with the BrowserShots of the test suite.
Continue reading →
UPDATE: You’ll want to check out the updated post with new code, tests, and compatibility.
Chances are that if you’ve done any significant Javascript work, you’ve run into a situation where part of the debugging process could be much improved if you just had the function call stack.
I’m going to give you some ways of doing this with and without the popular Firebug extension and have some examples of their uses.
Without Firebug and friends? Using IE?
Sometimes s**t only happens in other browsers. Here’s how to create/log your own stack trace. Put this code in an accessible place in your Javascript file(s) and call the printStackTrace() function inside any function.
I’m going to give you some ways of doing this with and without the popular Firebug extension and have some examples of their uses.
Without Firebug and friends? Using IE?
Sometimes s**t only happens in other browsers. Here’s how to create/log your own stack trace. Put this code in an accessible place in your Javascript file(s) and call the printStackTrace() function inside any function. Continue reading →