Earlier quoted context omitted.
How would multiple cursors be affected by this? I use a proportional typeface and multiple cursors for all sorts of things, I can't really see how these concepts are even related. As you say, use automatic formatting and you don't need to worry about line-length. (Otoh, having a mandatory max line length makes about as much sense as having a max identifier length or a max lines per file.)
You can't drag a cursor down vertically and know what will happen, something I do surprisingly often because it is very powerful. Line length guide lines makes sense for me as a visual indicator of what will wrap when I hit the max lines per file. They are also nice ways to gauge when you are nesting too deep or making overly complicated expressions. Max line length allows you to do nice things with window management…
Monospaced Programming Fonts with Ligatures
201–210 of 246 posts
Re: Monospaced Programming Fonts with Ligatures
#202Earlier quoted context omitted.
The diff could be smarter and notice that you just inserted some white space. Many GUI apps actually do that but unfortunately not your typical diff or git which insist in dealing with full lines only.
I'm sure many know, but for those who don't, `diff` (and `git diff`) accept -w and -b to ignore all white space and changes in the amount of white space, respectively. I find these very handy. Somewhat related, if you're looking at a diff on GitHub and want to ignore whitespace, you can just tack on `?w=1` to the URL ( https://github.com/blog/967-github-secrets ).
Re: Monospaced Programming Fonts with Ligatures
#203> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…
Sublime-text-style multiple cursor text manipulation would break here. And your code would look different than everyone else's machine. How would you display a guideline to make sure you were under a characters-per-line style? What advantages are there? I could never see it working for me. I want a program to format my code with resonable defaults and be done with it.
Not if you use an indentation-only style like my second example. One of the great things about that style is that it looks the same on anyone's machine, whatever kind of font you use.
If you read some of my code, you'll never know that I wrote it in a proportional font. It looks the same if you view it in a monospaced font.
> How would you display a guideline to make sure you were under a characters-per-line style?
Most programmer's editors have more than one way to do that. There is usually a column number in the status line, and some editors can be configured to change the background color on any part of a line that exceeds your required line length. That works with any font, and it's visually less obtrusive than a red vertical line partway across your editor window.
Also, an indentation-only style naturally leads to much shorter line lengths. If you compare my two examples above, the column-aligned version extends to column 77, while the indented version only goes to column 40! That's barely half the line length for the same code.
In practice, I think a lot less about line length since I switched to the indentation-only style, since my lines of code tend to be so much shorter as a result. And I tend to write the simplest functions I can without excessive nesting, so it's pretty rare that I come close to any worries about line length.
> What advantages are there?
For a proportional font, I simply find it easier to read and nicer looking. And as I mentioned, it also helped teach me to use indentation instead of column alignment.
I'm not saying you or anyone should necessarily convert the the Proportional Church, only that it is a worthwhile exercise to try it for a while.
Re: Monospaced Programming Fonts with Ligatures
#204Re: Monospaced Programming Fonts with Ligatures
#205Earlier quoted context omitted.
> 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?
I 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…
In code, I'm frequently tracing back and forth through a block, looking for specific information in different lines. I think that the coloration helps to provide "landmarks" for non-linear traversal of the code. I'd consider color-free code to be more similar to un-punctuated text, than I would consider colored text to be to colored code.
Re: Monospaced Programming Fonts with Ligatures
#206Earlier quoted context omitted.
Agree on indentation-only-style. Alignment is just a painful mess to maintain every time I encounter it.
Use a decent code editor? Jetbrains editors have it built in (change some settings and then ctrl+alt+l does it for you.) Sublime, VSCode, Atom, etc.. all have prettify plugins. Aligned code is easy to read code. Aligning code is a pain in the ass. A good code editor once again saves the day (and man hours!)
Re: Monospaced Programming Fonts with Ligatures
#207Earlier quoted context omitted.
Let me test something. Edit: crap, doesn't work
Unicode has some wonky characters - I use zero-width space, probably the most ridiculous of them to bypass filters at times. For intentionally wide spaces you have a few options: Test unicode non-breaking space. Test unicode narrow no break space. Test unicode figure space. EDIT: So there you have it, if you want a non-breaking space on hackernews, use unicode's figure space or narrow non-breaking space. Apparently t…
Re: Monospaced Programming Fonts with Ligatures
#208Earlier quoted context omitted.
After 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…
> Ideally, I think I'd like to have [comments] deemphasised by moving them off to the margin or something like that This is one reason I'm a fan of Douglas Crockford's slightly unorthodox style of always beginning comments in column 0, rather than indenting them along with the code. This helps, to a small extent, in differentiating comments from code. Example: https://github.com/douglascrockford/JSLint/blob/master/js…
[1]: https://wiki.haskell.org/Literate_programming [2]: https://ghc.haskell.org/trac/ghc/wiki/LiterateMarkdown
I've dabbled with it and enjoyed it, but I really feel like it needs editor support to feel truly fluent (i.e. being able to preview the formatted version on the fly, being able to collapse the text blocks, etc.).
Re: Monospaced Programming Fonts with Ligatures
#209> Picking a programming font is like picking a religion. No matter what you pick someone will say you're wrong. Most people will agree at least that monospaced fonts are ideal for reading code and that both of you who use proportionally spaces fonts are destined for hell, or at the very least, purgatory. I guess I'm destined for hell or purgatory then. Hanselman is not alone. I had the CEO of one company look over my…
Does anyone have a recommendation? I'm having trouble finding anything at the moment.
Re: Monospaced Programming Fonts with Ligatures
#210Earlier quoted context omitted.
After 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…
Reading code isn't the same as normal book or news reading. You don't need to actually read the whole code. Most of the time we looking for a specific variable or function call. Syntax highlighting allows you to filter out everything that's the wrong color to find what you're looking for faster. I've tried to look at code without highlighting and I can't read it because the color gives me additional context (metadata…