Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm always surprised when I meet folks who prefer not using syntax highlighting. At some point the surprise will go away, but for now it's still pretty darned rare. The first person I met who expressed a strong preference for no syntax highlighting was Matt Trout (mst here at HN), who is certainly productive enough to provide a compelling argument in favor of it.

I might even try it again one of these days.



I find it interesting that mst isn't into syntax highlighting as his main language (Perl) has string interpolation. Making sure that variables embedded in a string stand out can be important:

  "Number of Records: $numrec\n"
  "Number of Records: \$numrec\n"
  "Number of Records: ${\ get_number_of_records() }\n"
  "Number of Records: \${\ get_number_of_records() }\n"
Or

  my $string = <<"    HEREDOC";
  my $name = "Thompson";
      HEREDOC
It's much less important in something like C where you would just being using something like sprintf().


Perl is also my primary language, and it is partly why I like highlighting. It may state something about the opinions of the programmer; perhaps that complex interpolations in strings, among other things, might be a code smell they don't like, and avoid. Having no highlighting would remind you not to do that sort of thing.

I think the sigils alone are sufficient to flag variables in strings...but when things get complicated and span multiple lines, it can become ugly and difficult to work with. But, I'm not convinced this is the most useful function of highlighting in perl (again, because the sigils already provide visual clues)...it think it's more useful in pointing out unclosed parens, brackets, quotes, etc., and letting you know your syntax is wonky.

That said, it may be laziness on my part. I find it soothing to have highlighting enabled, and I get nervous when it's not, as I'm never quite sure I've got the syntax right until I check it.


It has been on my mind to write an Ask HN about syntax highlighting since I have seen a shift in people the last 15 years from preferring no syntax highlighting to preferring the Angry Fruit Salad[1] kind of highlighting.

Personally, I like limited syntax highlighting: I only highlight strings, comments and sometimes keywords (in Common Lisp). It lets me quickly separate the code in useful chunks and also highlights a common source of errors that I make (made): forgetting to close strings.

Here's a screenshot: http://imgur.com/rx053 (My Vim color scheme isn't quite there yet: the colors are too bright.)

[1] http://www.catb.org/jargon/html/A/angry-fruit-salad.html


Hmmm, I've hacked with mst a few times and I could have sworn he used highlighting, albeit basic.


It was several years ago. He may have changed his tune. But, he was very emphatic about it at the time.




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

Search: