Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've tried proportional fonts and gave up as the programming languages tend to emphasize punctuation and put crucial meaning in it, but in proportional fonts the punctuation is a second-class citizen, and this is reasonable for natural languages, but is not good for programming languages.


Could you give an example or two of program code where a proportional font made the punctuation hard to read or stand out less? I'm curious because I've coded in proportional fonts for ten years and haven't found that to be the case myself - with a couple of possible exceptions.

One is names_with_underscores. In a monospaced font, the underscore is the same width as every other character. In a proportional font, the underscore is one of the widest of characters, and much wider than a space.

For example, in the font I'm coding in right now, an underscore is 13 pixels wide, a parenthesis is 8 pixels, and a space is only 5 pixels!

So what happens is that the underscore in a way gives more visual separation in an expression than spaces or other punctuation.

  var foo_bar = some_function(one_param, another_param);
To some degree, my eyes group that code this way:

var foo bar = some function(one param, another param);

My solution for this is simple: don't use names_with_underscores (except when language conventions require it, such as in Ruby), and do add spaces inside the parentheses:

  var fooBar = someFunction( oneParam, anotherParam );
Why do the spaces go inside the parentheses and not outside? Well, you need a space in there somewhere, and this just doesn't work for me:

  var fooBar = someFunction (oneParam, anotherParam);
Nor this (with no space at all):

  var fooBar = someFunction(oneParam, anotherParam);
To me, the space belongs at the same place where I might put a line break if I had a too-long line. I would never break lines like this:

  var fooBar = someFunction
      (oneParam,
       anotherParam);
or like this:

  var fooBar = someFunction(oneParam,
      anotherParam);
But I do break lines like this:

  var fooBar = someFunction(
      oneParam,
      anotherParam
  );
This way the spacing goes in the same place regardless of whether it's a space or a linebreak.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: