2 ms·
I like to think of syntax highlighting as a quick draft-parse. It lets you know how the computer is parsing the code structure. I know, "Code is written for hum
by qu4z-2 12y ago
I like to think of syntax highlighting as a quick draft-parse. It lets you know how the computer is parsing the code structure. I know, "Code is written for humans to read and only incidentally for computers to execute", but you'd be quite put out if the computer didn't execute your code.
If human languages were written for one more-or-less uniform reader, I'd love a feature that showed how people would resolve pronouns ("Mary gave Sue her laptop.") or ambiguous attachment in general. Granted that's semantic, and probably closer to the feature in some editors where other instances of the same variable are highlighted on hovering, but they are both a form of visual feedback as to how the input token stream will be interpreted. I'd also say it's more important to get that information with a computer, because humans are pretty good at error recovery, and can often resolve syntax errors at the semantic level ("This sentence doesn't make sense; presumably it's a typo and <x> was meant, because that makes sense in context.")
In fairness, I dislike most highlighting schemes, but they definitely have a certain value.