5 ms·
Apparently I'm one of the two users of proportionality spaced fonts for coding. I've used this now for five years and I don't understand why developers still se
by edejong 9y ago
Apparently I'm one of the two users of proportionality spaced fonts for coding. I've used this now for five years and I don't understand why developers still see this need to code as if monospaced terminals is all that's available. Especially on large screens with high dpi it reads much faster. It also makes it less awkward to use editor unicode substitution for display purposes.
- simias 9y agoIf like me you really like aligning your code proportional fonts are not exactly pleasant to use. I sometimes go out of my way (within reason) to have variables with the same number of letters so that I can align them nicely. A bane of my existence is that "width" and "height" don't have the same number of letters. An example from some lua code I'm working on at the moment: local hi = buffer:bitfield(4, 4) local lo = buffer:bitfield(12, 4) return bit32.bor(bit32.lshift(hi, 4), lo) I find that aligning things not only looks better but also makes the differences more obvious. Same code with a proportional font: local hi = buffer:bitfield(4, 4) local lo = buffer:bitfield(12, 4) return bit32.bor(bit32.lshift(hi, 4), lo) It's not a deal breaker (and the offset is small in this case) but I much prefer the monospaced version. Obviously it might also be "Stockholm syndrome" after decades of coding with a monospaced font, I can't say I've really given proportional fonts their chance. Also many proportional fonts make it hard to distinguish between Il1 or O0, but I guess you could design a proportional font that doesn't have this issue. What font do you use yourself?
- arnsholt 9y agoThe Il1 problem is primarily a problem with sans-serif fonts. In my work SmallTalk text is set in Arial in the default image, but I've set up my development image to use Cambria instead which is really quite nice. The inability to do vertical alignment outside of the left edge of the line is a bit annoying, but honestly I don't miss it that much. If you have enough code that you really, really need to do that, I find it's a code smell indicating that something likely needs to be broken into smaller pieces anyways.
- edejong 9y agoI'm normally using Optima when working on Retina displays (because of serif typeface). Screenshot [1] of some old project for solving Project Euler problems (no solutions can be found in the screenshot). [1] http://imgur.com/a/JiYhD http://imgur.com/a/JiYhD
- arnsholt 9y agoAfter programming in SmallTalk for a while, I'm starting to come round to a similar point of view. I haven't quite made the leap in my day-to-day work yet, but I really am considering it. Another thing I'm considering to adopt from ST is dropping syntax highlighting. If research on highlighting for natural language can be transferred to code (I'm not entirely sure, but I suspect it might), highlighting might actually be harmful to comprehension. The only thing I'd keep is a slightly lighter colour for comments, as these don't have quite the same status as code. Ideally, I think I'd like to have them deemphasised by moving them off to the margin or something like that, but that requires rather more work than rendering them a lighter colour than the rest of the code.
- TeMPOraL 9y ago> If research on highlighting for natural language can be transferred to code (I'm not entirely sure, but I suspect it might), highlighting might actually be harmful to comprehension. Interesting. Could you share some of that research and its conclusions?
- arnsholt 9y agoI don't remember whose research it is (it's a bit removed from my field of expertise =), but the gist of it is that they tried to highlight different parts of speech in running text in different colours, and showed that it actually decreased reading speed and comprehension. Of course, there are several possible error sources (unfamiliarity with the colouring scheme for example), and whether this can be transferred to reading code is an open question. But I still think it's important to keep the existence of this kind of research in mind when discussing this kind of question (and also the similar question of mouse-driven interfaces vs. keyboard shortcuts), as it easily devolves into strongly held opinions and arguments along the lines of "it stands to reason that $opinion-held-is-true"
- keenerd 9y agoOn the other hand there is Color Forth, which replaces syntax with color. It produces extremely compact code.
- nijaru 9y agoPersonally I use input[0] which is easy to customize before download. If you aren't using a terminal-based editor, I really don't see the point in monospaced fonts either. I've never had an issue distinguishing differences because of the font style. [0] http://input.fontbureau.com/ http://input.fontbureau.com/
- yourapostasy 9y agoIt could be a function of the kind of programming you engage in. When I write code that reads more like long-prose, then I do prefer proportionally-spaced fonts myself. This is generally characterized as code with a low density of variables and constants, and lots of control and data structure manipulation. However, when I write code with lots of objects, I tend to prefer monospaced fonts. This is because my personal aesthetic style is to line up groups of related entities and logic; an IDE that gives a modern example of doing this is Eclipse [1]. For IDEs I have to use for a specific project that don't support such formatting, Emacs makes this easy to re-flow so adding a new variable, shortening or lengthening an existing one is still quick. The impact upon version control is still annoying, though; AST-sensitive merge/diff/version-control can't arrive soon enough for me. Fortunately, my code is not regularly inflicted upon others within a team; when I do have to work within a team, I put up with not carrying out my personal preference and use the code formatter that comes closest to the team's formatting standards before checking in. I do this because it helps me read my own source code quicker. Blocks of entities and logic related by domain and not intrinsically related through the language itself happen to be easier for me to read when I line up like this. This all goes back to a phase I went through a long time ago when I tried to figure out how to adopt literate programming in all my own work, within the context of an integrated single-source publishing, version control, testing, training, and problem management environment. In my mind's eye, I imagined all the media and activities surrounding a software product related back to the code in some manner, with the code displayable in different contexts based upon the AST and domain-specific hints, and when I made a change in either, I could see and manage the change in the network of related nodes. So if I change how a GUI behaved, then the parts of the User Guide that reference the old GUI, list of users who logged problems documenting confusion about that part of the GUI, etc. would all be automatically flagged. The User Guide would automatically get updated graphics content available from the GUI testing as soon as the testing data was built, the training material as well, and the users would get a note from the support team when the next version was released, detailing the change. I eventually decided that mountain was one I wasn't going to grind down myself anytime soon, so my code formatting is one of the many small ways I preserve that ideal. [1] https://stackoverflow.com/questions/13936569/eclipse-auto-align-in-assignments https://stackoverflow.com/questions/13936569/eclipse-auto-al...
- 9y ago
- mcbits 9y agoI also prefer proportional fonts, but some people's "ASCII artsy" programming styles, along with editors themselves, make it hard to use readable fonts in practice. What I would like is a language-aware editor that can visually align assignments, parameters, etc. without touching the actual whitespace characters. You get 1 tab for indentation (if the language allows tabs) and 1 space for alignment, and the editor takes care of the rest. The raw text would still be readable enough and use fewer bytes for people who prefer to code in a monospace terminal over SSH over an acoustic coupler from a phone booth in rural Texas.
- armagon 9y agoIt isn't quite what you asked for -- doing this automatically would be really neat -- but the best solution I've seen is called Elastic Tabstops. http://nickgravgaard.com/elastic-tabstops/ http://nickgravgaard.com/elastic-tabstops/ I really, really wish this was available in the editor I fight with every day.
- khedoros1 9y agoEvery time I've tried using a proportional font, my mind doesn't want to see it as code. I can force it, but that gets uncomfortable, so I switch back after a short time. Even if I take the time to adapt, that means switching fonts in all my dev environments (between home and work, 7 OSes, 1-4 editors used in each). And a lot of my hobby code is data format conversion, emulation, etc, so I'd need to find a nice way to format the data tables. There's a good-sized category of things that have a bit of an adoption cost that I'm assured is worthwhile, but that I don't see a really solid reason to commit to. Proportional fonts is one of those (for me).