in reply to Improvement of < code > sections
As far as indenting is concerned, I agree with GrandFather. I also use indenting style (or lack thereof) to get a read on where people are. Experienced coders will go to great lengths to line up their code because it makes a huge difference in their ability to detect bugs and understand program flow. I tend to read confused or missing indenting generally to mean that someone either (a) still doesn't fully understand flow of control concepts or (b) doesn't grasp how important they are to understanding code. I will assume the need to spell out concepts rather than hint at them. I might take the time to be extra encouraging.
However, I do like syntax highlighting and am frankly very puzzled by the strong antipathy to it. Of course, it isn't perfect, but then again neither are my eyes. All the same, I find I am more likely to miss mistakes when I read code without highlighting than I am with highlighting - and that is even accounting for the odd parser mistake here and there. I use Xemacs Perl syntax highlighting all the time despite its bugs.
I don't like the idea of forcing highlighting on people, but I do think that the average reader of code is likely to benefit if we provided syntax highlighting by default. Even if the syntax highlighting did little more than mark keywords and literals, there would be a net gain. Of course, it goes without saying that any addition of syntax highlighting would have to be accompanied by a very easy way for syntax highlighting haters to turn it off.
If we did have syntax highlighting, I would also like to see an attribute on the code tag that allowed an author to turn highlighting off on a case by case basis. We also surround error messages and program output with code tags. These would not look right at all if they were color coded as if they were Perl code. Color coding would also be counter-productive to certain kinds of code, like obfu. And I also feel an OP should have the editorial freedom to reject color coding on his or her own posts as a matter of course if they dislike it strongly enough.
On a technical level, adding syntax highlighting would represent a major change to PerlMonks. We would have to change the way we rendered the web pages in several different places, add additional user settings, add a user interface to turn it on and off, and so on. Any such change would take some serious commitment from the gods because no code can be added or patched without their having the time to review a complex list of interconnected changes and approve them.
Best, beth
|
|---|