Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

A case against syntax highlighting

Name: Anonymous 2014-02-19 22:49

http://www.linusakesson.net/programming/syntaxhighlighting/
Do you rely on syntax highlighting when developing software? If so, you may be shooting yourself in the foot. In this post, I will argue that syntax highlighting, while aesthetically seductive, moves focus from content to form, and [b]discourages those who look at the code from trying to understand it[/b].

Name: Anonymous 2014-02-19 23:18

Retarded. You don't read code as you do natural language. Code encodes logic, and structure. Syntax highlighting makes that structure easier to extract.

Name: Anonymous 2014-02-20 0:08

Some of his arguments seem to have merit, but if you take them to their logical conclusion, you get code that reads like the following:

#include "ieee754dp.h"
ieee754dp ieee754dp_mul(ieee754dp x, ieee754dp y) { COMPXDP; COMPYDP; EXPLODEXDP; EXPLODEYDP; CLEARCX; FLUSHXDP; FLUSHYDP; switch (CLPAIR(xc, yc)) { case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): SETCX(IEEE754_INVALID_OPERATION); return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN): return y; case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF): return x; /* Infinity handling */ case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): SETCX(IEEE754_INVALID_OPERATION); return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): return ieee754dp_inf(xs ^ ys); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): return ieee754dp_zero(xs ^ ys); case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM): DPDNORMX; case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM): DPDNORMY; break; case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM): DPDNORMX; break; case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM): break; } /* rm = xm * ym, re = xe+ye basically */ assert(xm & DP_HIDDEN_BIT); assert(ym & DP_HIDDEN_BIT); { int re = xe + ye; int rs = xs ^ ys; u64 rm; /* shunt to top of word */ xm <<= 64 - (DP_MBITS + 1); ym <<= 64 - (DP_MBITS + 1); /* multiply 32bits xm,ym to give high 32bits rm with stickness */ /* 32 * 32 => 64 */
#define DPXMULT(x, y) ((u64)(x) * (u64)y)
{ unsigned lxm = xm; unsigned hxm = xm >> 32; unsigned lym = ym; unsigned hym = ym >> 32; u64 lrm; u64 hrm; lrm = DPXMULT(lxm, lym); hrm = DPXMULT(hxm, hym); { u64 t = DPXMULT(lxm, hym); { u64 at = lrm + (t << 32); hrm += at < lrm; lrm = at; } hrm = hrm + (t >> 32); } { u64 t = DPXMULT(hxm, lym); { u64 at = lrm + (t << 32); hrm += at < lrm; lrm = at; } hrm = hrm + (t >> 32); } rm = hrm | (lrm != 0); } /* sticky shift down to normal rounding precision */ if ((s64) rm < 0) { rm = (rm >> (64 - (DP_MBITS + 1 + 3))) | ((rm << (DP_MBITS + 1 + 3)) != 0); re++; } else { rm = (rm >> (64 - (DP_MBITS + 1 + 3 + 1))) | ((rm << (DP_MBITS + 1 + 3 + 1)) != 0); } assert(rm & (DP_HIDDEN_BIT << 3)); DPNORMRET2(rs, re, rm, "mul", x, y); } }

What's the matter, huh? Too dense for you? I guess you just don't want to really understand it.

Name: Anonymous 2014-02-20 0:18

>>3
Try colorforth.

Name: Anonymous 2014-02-20 1:26

>>3
If I wanted to read something like that, I'd simply stay with Lisp.

Name: Anonymous 2014-02-20 1:36

Before some retard posts the inevitable
>>5
I wouldn't want to read all those )))!

Think of

}
}
}

end
end
end

fioc
fioc
fioc

</thequickbrownniggerjumpsoverthelazynigger>
</thequickbrownniggerjumpsoverthelazynigger>
</thequickbrownniggerjumpsoverthelazynigger>

};()[]
};)();
};)();[])();

Name: Anonymous 2014-02-20 3:14

I'm just so sick of people's opinions. None of you have any idea what you're talking about and are just bumbling through life. Bumble on bumble beez!

Name: Anonymous 2014-02-20 3:18

>>7
Fuck off back to the art department, shithead.

Name: Anonymous 2014-02-20 4:04

I was having drinks with a VP at my company, he's about 50. Early in his career he was working at a large tech company in Canada. There was an older man in this company, about 60, who never seemed to do anything and always asked people to play ping pong. He'd get lunch with people, chat them up, but was quiet on details and didn't seem to work in any department, or at least no one said they worked with him.

One day, my VP asked him what his story was, and he told him this:

For many years he was a mainframe developer involved in all aspects of development, and he was quite good. He wrote low level drivers, networking libraries, application code, etc. He raised a family and had a good life. When he was 50 he decided to retire, and spent several years sailing, gardening, traveling, and playing ping pong.

One day, he received a call from his former employer asking him to write a driver for their proprietary mainframe, and offered him a lucrative contract. He steadfastly refused, enjoying his leisurely retirement and hating the idea of 'working for the man'. They offered him double the already high amount, and he still refused.

A few weeks later, they called him back. They explained that they had signed a billion dollar deal, and this mainframe driver was a total necessity- they had to have it. Must have. Deal would fall apart without it. And the mainframe driver code was so niche and esoteric, they literally couldn't find a single person on earth other than him who they could trust to write the code in a reasonable amount of time.

He still refused, and said there was no way he could do it. He was retired!

Still they persisted, and told him to give a number, any number. He said $5 million dollars, a number so absurd he didn't think they would possibly agree. Indeed, the company laughed and hung up on him.

A month later, they called him back. Still unable to find anyone else, they agreed to pay him $5 million, with a catch- he had to work a 9-5 at the company to 'support' the driver for 5 years, and his salary would be $1 million a year. His only responsibility would be to support that driver, nothing else.

After thinking about it for a few days, he agreed. He wrote the driver in a weekend, and for 5 years he played ping pong, read the newspaper, drank beer all day at work, clocking in his 9-5 and collecting his $80k a month. No one ever had a support issue with his driver.

According to my VP, he was one of the happiest men he ever met.

Moral of the story? There is a good argument to being a generalist, learning all you can about many technologies. However, being an expert in a niche technology can also pay extraordinary dividends. Take a look at COBOL programmers who work on the financial system mainframes- sometimes it pays to be esoteric.

Name: Anonymous 2014-02-20 14:26

A couple of years ago I wrote my own text editor, when I first started using it it didn't have syntax highlighting yet.
I was surprised how little I missed it. When I finally implemented it I ended up turning off everything except highlighting for comments and strings.

Name: Anonymous 2014-02-20 18:42

>>9
Nice story. I like it.

Name: Anonymous 2014-02-21 12:15

#include "ieee754dp.h"
ieee754dp ieee754dp_mul(ieee754dp x, ieee754dp y) { COMPXDP; COMPYDP; EXPLODEXDP; EXPLODEYDP; CLEARCX; FLUSHXDP; FLUSHYDP; switch (CLPAIR(xc, yc)) { case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): SETCX(IEEE754_INVALID_OPERATION); return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN): return y; case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF): return x; /* Infinity handling */ case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): SETCX(IEEE754_INVALID_OPERATION); return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): return ieee754dp_inf(xs ^ ys); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): return ieee754dp_zero(xs ^ ys); case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM): DPDNORMX; case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM): DPDNORMY; break; case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM): DPDNORMX; break; case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM): break; } /* rm = xm * ym, re = xe+ye basically */ assert(xm & DP_HIDDEN_BIT); assert(ym & DP_HIDDEN_BIT); { int re = xe + ye; int rs = xs ^ ys; u64 rm; /* shunt to top of word */ xm <<= 64 - (DP_MBITS + 1); ym <<= 64 - (DP_MBITS + 1); /* multiply 32bits xm,ym to give high 32bits rm with stickness */ /* 32 * 32 => 64 */
#define DPXMULT(x, y) ((u64)(x) * (u64)y)
{ unsigned lxm = xm; unsigned hxm = xm >> 32; unsigned lym = ym; unsigned hym = ym >> 32; u64 lrm; u64 hrm; lrm = DPXMULT(lxm, lym); hrm = DPXMULT(hxm, hym); { u64 t = DPXMULT(lxm, hym); { u64 at = lrm + (t << 32); hrm += at < lrm; lrm = at; } hrm = hrm + (t >> 32); } { u64 t = DPXMULT(hxm, lym); { u64 at = lrm + (t << 32); hrm += at < lrm; lrm = at; } hrm = hrm + (t >> 32); } rm = hrm | (lrm != 0); } /* sticky shift down to normal rounding precision */ if ((s64) rm < 0) { rm = (rm >> (64 - (DP_MBITS + 1 + 3))) | ((rm << (DP_MBITS + 1 + 3)) != 0); re++; } else { rm = (rm >> (64 - (DP_MBITS + 1 + 3 + 1))) | ((rm << (DP_MBITS + 1 + 3 + 1)) != 0); } assert(rm & (DP_HIDDEN_BIT << 3)); DPNORMRET2(rs, re, rm, "mul", x, y); } }

Name: Anonymous 2014-02-22 2:56

>>12
Syntax highlighting and a monospaced font? Why don't you just go all the way and put in illustrations of an animal in a comical hat? You could call him ``Donny the Double-Precision Dog'' for fuck's sake. You make me sick.

Name: Anonymous 2014-02-23 3:21

>>9
source

Name: Anonymous 2014-02-23 15:24

>>1
Syntax highlighting considered harmful. Lisp goes well without it, because Lisp has no predefined keywords.

Name: Anonymous 2014-02-23 16:33

>>15
Lisp has no predefined keywords.
CL-USER> (loop for s being the symbols of (find-package :keyword)
sum 1)
=> 2341

lol

Name: Anonymous 2014-02-23 16:48

>>16

You example only proves you wrong. The symbols "for", "being", "symbols" and "of" are not part of the core language, while in languages like C/C++ these keywords are built in into the language.

Name: Anonymous 2014-02-23 16:55

>>17

YHBT

Name: Anonymous 2014-02-23 22:44

>>15
The reader defines the textual ``syntax'', and there's obviously some amount of punctuation. lambda is arguably a predefined keyword.

Name: Anonymous 2014-02-26 3:29

>>19

I still see no use of rendering lambda colored right in your face. The coloring the instances of the same variable would have made much more sense, than coloring a stupid keyword, yet no text editor highlights variables.

Don't change these.
Name: Email:
Entire Thread Thread List