Hacker News new | past | comments | ask | show | jobs | submit login

I've been programming for 30 years now, I remember back before syntax highlighting. I had a bug that I couldn't track down - it took forever. I had an infinite loop that would only run 3 times and then exit.

Here was the problem:

  for (int i=0;i<3;++i) {
    /* Initialize important things.
    frozzleTheNozzle();
  }

  while (1) {
    /* Do ALL THE THINGS. */
    makeSureTheNozzleStaysFrozzled();
  }
Syntax highlighting prevents the entire class of bugs from happening (as do compiler warnings, but hey). I told one of the other guys I was working with, and he introduced me to emacs which had just gained font-lock mode.



The lack of syntax highlighting in your comment really illustrates the problem nicely. Took me longer than it should have to spot the problem!


Heh, I tried to scroll to the right to see the rest of the line. Swift's nested block comments would sort of fix the problem, but syntax highlighting would work with C.

I will say though that highlighting comments and strings separately from the code doesn't necessitate full syntax highlighting. I remember (and have saved somewhere) an article on syntax highlighting where only comments were highlighted.


Also automatic indentation.


Yes, this alone will often spot problems such as unterminated comments or unbalanced brackets. When the next line doesn't indent to where it should be, you know there's a problem somewhere above.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: