by michaelochurch · 15y ago · 0 comments
"Bad" typography isn't a big deal IMO. Yes, it's slightly embarrassing and ugly, in this Unicode-enabled era, that we use <= for "less than or equal to" and != for "not equal to", when Unicode has given us better glyphs. But honestly, I don't see how that costs us much time to get used to. It's like the parentheses in Lisp: more time is spent complaining about things like that than just adapting to it and making the problem go away. Parentheses wouldn't even crack the Top 5 of my complaints about Clojure (which is, despite some flaws, a great language).
Regarding monospace fonts, monospace is a huge asset. Sometimes you want to align a column of numbers, and you don't want 11111 to be narrower than 8888. Code isn't supposed to be "pretty" in the sense as a word document or marked-up Latex file. It's supposed to be easy to read and understand. Aesthetics are a part of this, but beauty at the expense of clarity is a no-go. Technical book writers could easily use non-monospace fonts for code examples and they don't-- for good reasons.
What matters is how the language looks after you've been using it for months. After 6 months using it, does the language still piss you off on a regular basis (note: no language is perfect and all will piss you off sometimes) or do you generally enjoy working in it? I've found that statically typed functional languages (Scala, Ocaml, Haskell) perform the best in this regard. The worst I've seen are Java and C++. But until you get comfortable with the languages, they all look the same (hideous, confusing, foreign).
We need to get rid of that kind of thinking—not just so that language design can move forward, but so that we can quit worrying about languages and get shit done.
Sorry, but... language differences aren't really about superficial appearances. Ocaml could be re-written with S-expression syntax and it wouldn't be much different. These differences are much deeper than that. The shape of code that emerges in a Haskell codebase is dramatically different (more "foreign" compared to conventional imperative programming, but generally less verbose and easier to maintain) from what appears in a C++ or Java codebase.
<= and != are easier to type than using alt-codes for unicode characters. Unless you want your programming language to come with a keyboard driver for every OS that only is used for that language, there is no reason to use it.
Just use rfc1345 digraphs. In vim, do :set dg to enable, then just type <(backspace)=. Easy. Emacs also supports this.
I don’t think tech writers necessarily use monospace fonts for good reasons—most likely they’re simply accustomed to it, and it doesn’t occur to them that there’s something better out there.
And this isn’t just about superficial appearances—I focused on poor legibility because it’s a readily apparent detriment to usability, but there are plenty of other things wrong with programming languages—enough to fill a book, which I should probably write. Strictly imperative programming, for instance, is a degenerate style of problem-solving that forces developers to exert far more effort than necessary to get the same amount of work done. Haskell is better, and more productive for me, than any procedural or object-oriented language I’ve used.
Thanks for the comments, though. I really appreciate this kind of long-form feedback because it helps me improve my future writing.
abcde 11111
ilili 22222There's a reason we're not all using APL.
(Okay so there's a couple. But yeah.)
Actually, Stroustrup did use a proportional font (and an italic one at that) for the code samples in The C++ Programming Language.
I've never seen anyone doing serious research on the effect of this style on comprehension or reading speed. Subjectively, I didn't find it unduly difficult to read. I suspect any concerns over alignment could be overcome by using the same typographical tools we use in other contexts: tabs/tables, proportional vs. lining figures, etc. We already use specialist editors and fonts for programming routinely anyway, so I don't see any inherent reason we shouldn't make them look good. :-)