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

I find syntax highlighting is particularly useful in tightly-packed constructs. Consider this function returning a string interpolation in CoffeeScript:

     (d) -> "id-#{d[@id]}"
In my default color scheme, the #{} (string interpolation), @ (this pointer), and () (function parameter delimiter) are muted, since they're syntactically critical but not helpful to my understanding.

The "id-" is more subtle than code but more visible than the muted syntax, because I only sometimes care about the string literal, and the array indexer [] is about the same.

The identifiers d and id are the regular typeface, since those are the code items.

The -> which creates a closure is brightest, because creating a closure is a relatively heavy operation and it's useful to be able to pick them out at a glance.

I understand that you CAN read it without highlighting, but the signal-to-noise ratio is much worse. In particular, the hash mark and atpersand stand out much too prominently.

The linked article is concerned about breaking up the "natural flow of the text", but I think that misses a critical observation. While prose text flows from left to right, line by line, that's not how code flows. Code's flow is in its structure.




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

Search: