Clear questions and runnable code
get the best and fastest answer
Re^2: perltidy in PM posts (read blues)by tye (Sage)
|on Nov 23, 2011 at 07:45 UTC||Need Help??|
Not to criticize you, ansh batra, but just to, I hope, inform you a little and perhaps amuse you, simply because I enjoyed your comment about newbies the most of the comments so far... :)
Yes, syntax highlighting certainly makes things easier to understand for newbies. Consider perlop. This excerpt would just be so much harder to understand if I hadn't copied the "syntax highlighting" from perldoc.perl.org:
The fact that the only text within sight that is blue is the three '$' characters (I'm sorry, I should have made that dollar sign that I just typed blue; I'm sure I've confused most of the newbies now) clearly indicates something that newbies would not have understood without the clarion indicator of "blueness" (every newbie knows what blue means in that context; that goes without saying).
But that pales in comparison to the boundless clarity that is only possible by having the red parts be red.
The indentation getting a bit wonky in a couple of places is such a small price to pay for these huge leaps in clarity of the text.
On a serious note, if you want to know about syntax highlighting at PerlMonks, then there are several facilities provided for searching for such things.
I'm sure somebody will soon post links to no small number of previous discussions. (Ah, yes, as I expected, this happened before I even finished composing this.)
In the mean time, I'll summarize: If you want colors assigned to things based on some algorithm that clearly fails when it tries to parse some Perl code and fails even more interestingly when it tries to parse things that aren't Perl code as if they were Perl code (or if you want to go the stackoverflow route of assigning colors based on some vague feel of "bits of syntax that are somewhat common to more than one programming language"), then you need to pick the poison of your choice and impose it upon yourself. And that isn't particularly hard. I'm sure some of the linked threads even provide instructions (but I didn't check).
Though, if anyone still thinks that either of those approaches won't often decrease clarity, then I suspect that mostly means that they don't pay all that much attention much of the time. (:
BTW, the perldoc example is just something I stumbled upon last week. I wasn't even looking for examples of "syntax highlighting gone wrong". I run into those often enough without looking for them and that's even though I never use syntax highlighting by choice.