Exceptional coding style

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Jan 15 17:39:50 PST 2013


On Wed, Jan 16, 2013 at 02:06:59AM +0100, Era Scarecrow wrote:
> On Tuesday, 15 January 2013 at 22:35:04 UTC, Jonathan M Davis wrote:
> >I've had _one_ coworker that I know of who liked using. I still
> >don't understand how he could read code that way. Proportional
> >fonts make perfect sense for normal text, but they're horrible for
> >code. Nothing lines up right. That's why I hate writing code in
> >e-mails. Not only is it hard to get right with a proportional
> >font, you don't even know if it's going to look the same for the
> >person reading it.
> 
>  I remember being taught Java and helping everyone else debug their
> code. One girl had changed her fonts to this really fancy cursive
> font with purple & pink color. Why, I have no clue. Being too hard
> to read I refused to help her.

Maybe I should invent a programming language in which color has semantic
value. And fonts. :-P

In fact, that might be a solution to the creeping modifierism that
modern functions seem to have contracted: first it's just return type,
function name, arguments, then there's const, then pure, then @safe,
then nothrow, and all that jazz. If we could map @safe->green,
pure->blue, and nothrow->red (or lack thereof), then a pure nothrow
fuction would be blue, a pure throwing function magenta, a @safe pure
function cyan, and a @safe, pure, throwing function would be white.

Then const can rendered in italics, non-const in upright, immutable in
Fraktur, ref in serif. This way, we can get rid of all those annoying
verbose modifiers and return to the pure joy of return type, function
name, and arguments. Fixing const issues in Phobos would be as simple as
selecting the entire source code and changing the font to italics. :-P


T

-- 
The easy way is the wrong way, and the hard way is the stupid way. Pick one.


More information about the Digitalmars-d mailing list