Until recently, I've done my Erlang debugging either using the built-in debugger or not using a debugger at all and instead relying on the good old io:format() function. The reason I haven't been keen on using the Erlang debugger is that it's not integrated into my editor (I use Emacs). To debug a file, I'd have to open it separately in the debugger UI, where I could set breakpoints and step through the code. For simple bugs, this is more effort than adding a few io:format() statements, reloading the page, and figuring out the bug from the output.
I'm not an IDE fanatic (well, duh, I use Emacs) -- I can do fine without most of the features in advanced IDEs -- but I do expect any decent editor to have at least 3 features: syntax highlighting, auto-indentation, and integrated debugging.
(I'm ambivalent about IDEs with code completion. It adds convenience, but it also it lets you get by without really remembering your APIs. Without code completion, I remember most of the my application's function names and their parameters simply because not remembering them slows me down too much. This is akin to the cellphone effect on remembering numbers: before I had a cellphone, I remembered all my close friends and family members' numbers. Looking them up in an address book was too much work. Now, I remember just a fraction of them. My cellphone made me lazy.)
The Emacs mode for Erlang provides syntax highlighting and auto-indentation, but no integrated debugging. AFAIK, neither Erlide nor ErlyBird have integrated debuggers. I knew Distel was supposed to add debugging support, and I even tried setting it up a while ago but gave up after running into problems I couldn't figure out. Last weekend, though, I finally got it working after following Bill Clemenson's Distel tutorial. I must say that having a debugger integrated into Emacs is a huge improvement. I recommend it to every Erlang hacker.
My only peeve with this debugger is that you must mark each file you want to debug as interpreted (the Emacs shortcut is "C-c C-d i") before you can set breakpoints in it and step into its functions. This seems unnecessary -- Erlang .beam files usually contain metadata including the location of their source files. I wish the debugger used this information to auto-interpret all the files you're trying to debug.
This is a relatively small peeve, though. The Distel debugger is definitely a step up from io:format().
I'm still hoping someone will create a more user-friendly Erlang IDE with a slick UI and an integrated debugger. I like the TextMate interface, but TextMate doesn't do auto-indentation for Erlang or debugging. I'll stick to Emacs+Distel for now.
5 comments:
Oh yeah, the perfect Erlang IDE, we are all waiting for ! And TextMate for Erlang just looks good but has little functionality and is mac only. And improving Erlang support (I gave it a try, see erlymate.googelecode.com) is even a bigger hassle, because TextMate is closed source, by a one-man company, so obviously nobody wants to take the risk to really focus on that.
I'm thinking the ideal IDE would actually be web based. I don't see a need for these heavyweight desktop apps. I'd love to be able to just log into my running app in an admin port and start hacking it. I know SmallTalk has something similar, but I want one for Erlang. With Comet, you can even implement real-time debugging. If Javascript is too slow, you can outsource the performance-intensive tasks to Flash9. In fact, I would write it in haXe so you can compile it either to Javascript or to Flash.
Sauder furniture....
Sauder furniture. Unfinished furniture....
Bean Bag Covers...
I found your site on technorati and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you....
That's basically my biggest beef with Vim (which I use for Python and Ruby, for the most part the only two languages I know in any real sense of the word). I've keymapped to save the file and execute, which then displays the output or throws an error, but once things start getting big, I have to switch to Eclipse for debugging and stuff, which is a pity, because Vim's TextMate Snippet Emulation and OmniComplete as well as the general text editing features of Vim itself stomp all over Eclipse and Netbeans.
I recently started to try to learn Erlang, which basically entails using emacs, and the chording is killing me, but at least Erlang mode in emacs is pretty nice otherwise.
Honestly, if I could just set Eclipse to use Vi keybindings and plugins, I'd switch to that in an instant.
Post a Comment