
Programming with proportional fonts is great - brokenmusic
http://m-mz.posterous.com/programming-with-proportional
======
tlrobinson
I can't stand proportional fonts for programming. Aside from it being harder
for me to read, inability to use any sort of ASCII art, etc, it just feels
sacrilegious.

Not to mention my editor of choice (TextMate) fails horribly with proportional
fonts.

But then again, I used to feel the same way about anti-aliased programming
fonts, and have since switched.

Currently Inconsolata 16pt anti-aliased is my font of choice. It helps to have
a big screen...

~~~
nailer
> inability to use any sort of ASCII art

That actually makes me support the idea of using proportional fonts even more.

\- If something's that complex you need a diagram to support it, that probably
doesn't belong in your code - you should maintain documentation in
documentation format, and doc updates shouldn't mean new code revisions. Throw
a URL to the documentation in as the comment.

\- Diagrams could be illustrated much better with an actual diagram rather
than an ASCII visualization of one.

~~~
Deestan
Design documents and complex diagrams don't belong in code, but a simple ASCII
diagram right there in the code to illustrate how the transformation tree is
created:

\- is always within easy reach of the eye.

\- is harder to forget about when changing the code.

\- doesn't require you to download, install, register and fire up Visio
Community Edition 2008 to add a new FileLogger node to the illustration of the
data transformation tree.

~~~
nailer
Simple and complex diagrams can be made in any decent graphics app (Inkscape
or Keynote are fantastic) and easily exported to PNG or SVG.

Personally I also have a lot of trouble reading ASCII diagrams. Knowing that
pipe-slash-dash is a curved line, when the line is broken and the ends don't
line up properly.

On a separate note, I suggest whoever moderated me to zero should read the HN
guidelines.

------
soren
"more text in an eye fixation" is not necessarily a good thing for reading
code, because code is semantically more dense than regular text. I think one
will not be able to absorb all information and therefore not get a faster
reading experience due to re-reading. I find the fixed-width font example
easier to read, because it appears not as cramped as the proportional-width
example, and I can easier get an overview of what the code does.

~~~
yungchin
Agreed - I don't think the speed-limiting factor when reading code is how fast
it transfers from screen to brain. That's totally different with prose, where
you often skip over almost 90% of the characters because the choice of words
that fit the context comes naturally - not quite the same for function call
arguments...

A possible benefit of fixed-width: say you take a for-loop (which you can
probably recognise even skipping over 95% of the characters) - now your brain
wants to extract the indices at which it starts and ends: it seems to me a
fixed-width font makes it easier to predict where you'll find the indices in
the given line. (Not sure if that's how my eye-coordination really works, but
it feels like it does...)

------
Raphael_Amiard
i don't know. Taking a clojure example :

    
    
        (defn say [word]
          (println "You said"
                   word))
    

This wouldn't be possible without fixed width. Now a lot of languages don't
use that kind of indenting a lot, but in lisps it's mandatory.

Also fixed width ensures that you can write code and it will lay in the same
way on other computers, regardless of what other fixed width font they're
using. That's a big big point i think, since code is most of the time a
collaborative effort

~~~
vdm
I agree, but I think it would be possible to have proportional text aligned
properly if you are working above the level of raw text, as in with sexps in
paredit.

~~~
repsilat
There are good heuristics for checking whether spaces are being used for
indentation. You can look at where they appear in the line, for one thing, and
whether they're in clumps of two or more for another. In those cases it would
be simple enough to make them align perfectly with the characters above/below
them.

Of course, you'd have to decide which to do - above or below. There are
reasonable heuristics for that, but they're probably more complicated and less
accurate.

The nice thing about doing it this way is that it degrades perfectly when the
code is viewed in fixed-width (which is good for tools and other developers).

------
igrekel
Or how about a font with proportions made for code?

I would imagine special proportions for markers like (){}[] and punctuation
marks and fixed proportions for numbers. At one point the difference between
that and syntax highlighting and automatic indentation blurs.

------
yannis
Maybe for a fortress program
[http://projectfortress.sun.com/Projects/Community/wiki/Integ...](http://projectfortress.sun.com/Projects/Community/wiki/IntegerSquareRoot)
my brain will allow proportional fonts, but for anything else it is actually
wired in such a convoluted way by now that it expects monospace!

------
kaib
I switched to a proportional font by mistake when I started using acme as my
primary editor. A few months later I realized what had happened and tested how
things looked in fixed width. Turns out I like proportional better.

A big difference was probably the fact that the codebase I was editing used
tabs for indenting and had non-ascii art indenting rules (basically just
indent the next line).

~~~
gchpaco
Acme works very well with proportional fonts, although it doesn't do relative
indentation well as a result (think lining function arguments up on the left
paren). Still a really brilliant editor in many ways.

------
nailer
I honestly think fixed width fonts are only used because of fixed terminal
widths, and when repeating instructions on separate lines was common enough
that the shape of a line being different was a kind of proto syntax
highlighting to show you'd done something wrong.

Ultimately, a space is a space in whatever font, so everything still lines up
along the left margin nicely.

------
mbrubeck
Bjarne Stroustrup's _The C++ Programming Language_ has all the code set in a
proportional font: bold italic Times. I found it at least as readable as any
other programming book. The ideal typeface is different for print than for
screen, of course.

------
abecedarius
When I tried this I liked it, too, but after a week or two gave it up: I write
code for others to read, and, sadly, _they_ will be reading it in a fixed-
width font.

~~~
tolmasky
I'm not sure I understand. Was using a proportional font changing the way you
chose to format the code to such a degree that it annoyed people?

~~~
ludwig
Leading spaces aren't much of a problem, but aligning comments on the right-
side is much harder due to the variable widths of each line. And even if you
align them in your editor, they'll be misaligned for people who use fixed-
width fonts. Does that make any sense?

~~~
MaysonL
Use a word processor (or a text editor that allows for fixed tab stops). This
will also allow insertion of diagrams and other non-textual stuff (think
clickable buttons, for compilation and testing, for example) into source code.

See, for an example implementation, BlackBox Component Pascal - Windows only,
but runs moderately well under Wine.

------
junklight
I think this is one of those "religious" wars things - although us
proportional fonts people are much the minority.

I've used proportional fonts since the early nineties and written thousands
and thousands of lines of code since then in a proportional font. I have
occasionally tried to go back to a fixed width font but I can't be bothered
trying to get past the "it makes my head" hurt stage. (and likewise I can't
imagine a lot of fixed width people getting past that stage going in the other
direction).

We can rationalise our choices all we like but I doubt that there is any
serious advantage or disadvantage in either.

------
DLWormwood
In my experience, proportional typefaces only work for code if the IDE/editor
is using a pretty-printer that uses word-processor style indentation. (That
is, it uses tab stops as opposed to just inserting spaces/tabs in the text.)

The only IDEs I've seen work this way was the old THINK Pascal from the 68k
Mac era, and its predecessor Instant Pascal for the Apple II. Anybody else
seen a more recent example in the wild?

~~~
dahjelle
Maybe not an IDE, but the AppleScript Editor in Mac OS X (and Classic, IIRC)
has you enter text in fixed width by default, but then changes it to a
proportional font after syntax-checking.

~~~
DLWormwood
Yup, completely forgot about the Script Editor. Though, as you say, it doesn't
really hew purely to monospaced type, but more of a hybrid. (Hypercard was
similar, IIRC.)

------
fr0sty

        Tomato  vs. Tomahto
        Bug     vs. Feature
        Tabs    vs.  Spaces
    

Either approach introduces about as many problems as it solves. I personally
like being able to line things up with a few extra spaces to give some hints
to my future self regarding the structure of my code.

~~~
iuguy
Except for Tabs, obviously. All those problems are space-specific ;)

~~~
fr0sty
You didn't notice I right justified then. My peeve with embedded tabs is they
are editor-defined and generally too wide.

    
    
        i       = 0.0;
        Tomato  vs.     Tomahto
        Integer vs. Doubles
        Integrals       vs.     Derivatives

~~~
jasonkester
Are you really using an editor that doesn't let you define your tab widths? I
couldn't name a single modern IDE that lacks that feature.

(and extra points to the grandparent for the ironically mis-spaced "tabs vs.
spaces" chart!)

------
Batsu
The second comment on the post:

Of course proportional fonts can be read faster. That's not the point.
Programming uses lots of non-standard glyphs, has meaningful syntax (eg.
parens, brackets), and often meaningful whitespace. You can real _words_
faster in proportional font, but (arguably) not _code_.

I agree completely.

------
ggruschow
gvim hates proportional fonts:

    
    
      E596: Invalid font(s)
    

I just can't bring myself to use emacs.

~~~
wendroid
<http://en.wikipedia.org/wiki/Acme_(text_editor)>

Available for Lunix (Linux / Unixes / etc)

<http://swtch.com/plan9port/>

~~~
ggruschow
I'm not sure I'm smart enough to use it, much less understand it. I can
understand that it's mouse based though, and I can't grasp how that would be
more efficient for the way I code. I am intrigued by the idea of no built-in
commands, relying instead on making external commands easy.. I guess I should
look at Oberon again too.

<http://doc.cat-v.org/plan_9/4th_edition/papers/acme/>

~~~
wendroid
It works best with the plumber, which is to pattern matching as file name
extensions are many file browsers. Plumb a uri and it opens the browser,
unless you added a more specific rule to follow a different action.

<http://swtch.com/plan9port/man/man4/plumber.html>

For instance in Plan 9 I mount the file system of my webserver (across the
internet), tail -f /n/remote/var/log/httpd/error_log.

An example error would be

[Thu Nov 26 15:28:15 2009] [error] PHP Warning: Invalid argument supplied for
foreach() in /staging/php/restricted.class on line 286

For which I have a plumbing rule

    
    
        type is text
        data matches '(/staging/[^ ]+) on line ([0-9]+)?'
        data set	/n/remote/var/www/$1 
        attr add	addr=$2
        plumb to edit
        plumb client $editor
    

My apache is chrooted so I set the un-chrooted path with relation to my plan 9
(the remote server is mounted at /n/remote)

So in Acme I plumb the error message and Acme opens the file (if it isn't
open) and scrolls to the appropriate line.

Ok this is nothing amazing in and of itself, other editors can do similar
things - EditPlus on Windows can scan error messages) but combining simple
things like this makes a bigger system.

Typing your own menus is also a great feature. You can whip up an awk script
and apply it to selected text.

Here's a little one

<http://plan9.bell-labs.com/sources/contrib/maht/rc/exe>

If I type 'exe doit' in the current window, select the text and middle click
it creates the file (in the pwd of that window) , chmods it, adds the hash
bang and opens it in new window.

Again, not amazing on it's own but one builds up such things over time and
there is no restriction on what language to use, I even have a few that ssh
into a remote server and run them there.

There is no best editor, but Acme is the best for me.

Oh and if you middle click Font it switches between the two specified fonts
(sans and mono by default).

------
JesseAldridge
It's hard to keep code within the 80 char per line limit of PEP8 without using
fixed-width.

~~~
jbellis
then again, that's probably the most obsolete recommendation in PEP8

~~~
sid0
I really like having two 80-char wide Emacs buffers side by side.

------
wendroid
ugh, syntax highlighting

this is what I use, it's available for Lunix too

<http://en.wikipedia.org/wiki/Acme_(text_editor)>

~~~
fr0sty
> ugh, syntax highlighting

Care to explain? I didn't know there was debate on this point.

~~~
wendroid
There is no debate on my personal preferences. But do you actually think that
_everyone_ uses syntax highlighting?

Obviously Dennis Ritchie and Rob Pike didn't need it and though I don't in any
way pretend I'm in that league of programmers, I am in that league of editor
users.

~~~
invisible
As crazy as it sounds, for the longest time I used notepad as my primary
editor. Then I switched to Notepad+ (still no highlighting). I'm now on
TextMate (mostly due to my switch to OSX), but I find the syntax highlighting
to help in quickly scrolling through and finding segments of code. If I'm
looking for a variable, I just look for that color, etc.

~~~
jasonkester
You're on your way... Come join the rest of us in the world of IDEs. Once
you've seen your "editor" autocomplete a member from another class (in a
namespace you haven't even imported), there's no going back.

~~~
nuclear_eclipse
I can do that in Vim...

~~~
jasonkester
Sweet. My Vim sessions generally consist of issuing a dozen random commands
before I happen to type an "I", followed by exiting, restarting, and cursing.
Glad to hear you're having more success!

