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].
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:
Anonymous2014-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.
>>7 Fuck off back to the art department, shithead.
Name:
Anonymous2014-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:
Anonymous2014-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.
#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:
Anonymous2014-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.
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.
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.