157 points · by susam · 4y ago · 195 comments
At work, I've tried it. I've tried hard to like it. I had to stop because Fira Code (and ligatured Iosevka) took the principle of the least astonishment, threw it on the concrete floor and kept beating it down till it stopped breathing, and then some.
I found myself spending time wondering "what characters is this made of?", and "how do I type THAT?" when viewing some existing code, and "WTF is this?" when a ligature that would have likely made sense in Ruby or Haskell (or in APL?) made it into my Perl code.
Also, "is this a ligature or some Unicode glyph?" was a question I found myself asking. In a better world, I shouldn't be wondering about it while fixing some integration with one of Intuit's molochs or somesuch. But here I was.
Switching to non-ligatured text shed a lot of cognitive burden off me. At least I can tell which thing is ASCII and how I type it. And my code doesn't look as a Guillome Apollinaire's calligramme.
I guess everyone's got their thing, but on that paragraph I have to say my experience with ligature'd fonts in programming has led me to wonder the same thing... never.
I don't say this over some love of them; I'm fickle and change fonts about quarterly; some with ligatures some not, but I can't think of a single instance of WTF or actual confusion.
But I'm glad it clicked for you.
Funny sidenote: I've got my Emacs configured to show any non-ASCII char in source code in bold pink on a pure black background (including zero-width spacing chars). That way the non-ASCII chars do really standout and I rarely wonder "which char is this?".
I don't forbid them: they do just really stand out.
Most of the time the only Unicode chars in source file are anyways the copyright symbol and some chars in author's name (in comment). Sometimes in strings.
I’ve heard somewhere that Java’s support for Unicode identifiers was originally motivated not only by “oh shiny” (although I expect there’s a measure of that, too), but also by allowing the Japanese to write their code how they wanted it, and apparently did indeed help with capturing mindshare. Though, to be fair, I’ve never actually seen Java code with Japanese identifiers.
(defun find-non-ascii ()
"Find and show all of the non-ascii characters."
(interactive)
(occur "[[:nonascii:]]"))In Sublime Text for some time, the C++ ligatures did not work. It is fixed now.
By default, no ligatures are used.
In code editors that use monospaced fonts the ligatures will often look nicer since things like Unicode arrows will only take up a single “character space”.
I do not like it when len('≡') == 3
Making my ":)" into an emoji is wrong. "Do what I meant" input magic bullshit is always going to be wrong about "what you meant" sometimes, and occludes the possibility of "I didn't know what I meant until I saw it" with its helpful corrections.
Have had this argument with fans of "autocomplete" systems, too. An analogy I like is a powered exoskeleton: if you had one you could run faster and jump higher and all these good things: but then when it breaks or you're not wearing it you've less native ability and no familiarity with the unassisted world, which makes you dependent on the tools.
Socrates had a similar opinion w/r/t reading and writing:
> This discovery of yours will create forgetfulness in the learners’ souls, because they will not use their memories; they will trust to the external written characters and not remember of themselves.
I feel like you and Socrates are incorrect for similar reasons.
Humanity advances when it can hide complexity. Tools help with that. To argue against tooling because it makes you dependent on the tooling is like telling the construction worker to put away the jackhammer and pick up the pickaxe. Programmers are super productive (compared to other professions) because we can build tools that make us better programmers. The leverage recurses.
Calling replacing ">=" with a ligature for "≥" "hiding complexity" strikes me as more than a bit of a stretch. They're two different visual presentations of the same thing, neither more or less complex in-and-of-themselves.
The ligature has some external complexity, though, in that for certain things I have to remember that that's "really" 2 characters in the file, and backspacing directly in front of ≥ will net me > instead of deleting the entire thing.
So if anything, ligatures are introducing a small bit of complexity that otherwise isn't there. Any relation to Socrates' quote seems forced.
Nobody today can memorize an epic like the Illiad today like people routinely would in Socrates' day. It a bit impressive if you can reproduce a 3 minute song text from memory. The Illiad often took days to recite.
Sure you can argue that tools (like writing) allow us to do more, to store more information, but the point is that they also cut us off from doing other things. Recitation from memory is available even when there is no paper.
This has gotten a lot worse recently, with tools like Wikipedia acting like external memory for a lot of people, granting them access to a lot of extremely superficial knowledge they don't actually possess themselves. It is certainly faster to look something up than to learn it, but a huge part of the benefit in actually knowing various things is to be able to connect what you are seeing now with something you know from beforehand, to generate a conclusion. That only works if you know the thing, you're not helped by theoretically being able to look it up.
The same with auto completion. Sure you can type faster, but it also means you, as a human, become less capable because you've never needed to hone the skills necessary to program without it. Programming without autocompletion is available in any text editor, even on paper.
Using tools is fine, but being completely reliant on them even to perform basic tasks is hobbling yourself. You turned yourself into an idiot in a powerarmor: Completely useless without your training wheels, unable to reason, unable to perform even simple menial tasks. I have a hard time seeing how that's made you, the human, more capable.
They can, and occasionally do. It tends to be people with a lot of spare time, or interested in memory techniques. And it probably helps if you know (ancient?) Greek, so it actually still rhymes. But it isn't super useful, so people generally don't.
If you paid people a living wage to recite the Iliad, you might get some more takers. We kinda do that, except it's actors in theatre plays or films. Sure, they don't take days to recite, but e.g. people put on several, different plays a year.
> It is certainly faster to look something up than to learn it
If it's faster to look it up, why bother learning it? Conversely, if someone had to look it up often, I bet it would be learned. Spaced repetition and all.
> The same with auto completion. Sure you can type faster, but it also means you, as a human, become less capable because you've never needed to hone the skills necessary to program without it. Programming without autocompletion is available in any text editor, even on paper.
I loathe this argument. Compilers or interpreters (computers in general) are sticklers for the exact spelling. Humans aren't; I still understood what you meant when you misspelled "Illiad". Why exactly spend the time and brainpower knowing exactly what something's called, as long as you have a rough idea of how the code works. Or, why spend the time typing it fully if you can have it auto-complete? When do you have to program in any text editor? Or even on paper, where the exact syntax can't possibly matter? (Equally, I'm sure that if this was a necessary skill, people could pick it up - occasionally they do, like for whiteboard interviews.)
Humans are very capable, and also lazy (one of the best engineering qualities). Don't mistake having no reason to do something with not being able to do something.
The goal of work is to achieve a goal. Whatever achieves that goal most efficiently while not creating problematic "debt" is always to be preferred.
Your example of "writing code on paper" is a perfect example of a non-problem. When you write code on paper, the name of the function doesn't matter, since this is not executable code. So, whether you call it "sort" or "order" is fully irrelevant. Even if you "call" a function that doesn't exist, as long as the intention is well captured, it's not a problem. Say, if I'm writing "C" on paper and I write `arr.Sort()`, that will not affect anyone: it's simply a way to express what I want to do. If I'm ever going to write this as a program, I may use qsort(), or implement an actual sort function, or whatever makes sense.
Overall, memorizing things that don't need to be memorized "just in case" is more a circus trick than an actual useful skill.
AFAIK this isn't something that was very common back then. Reciting the Illiad was not a hobby but more like a paid profession. People paid for this precisely because reciting something for a few evenings from memory takes a lot of skill/training and most simply couldn't do it. Same as today.
I am someone that wants to know 'enough' about how stuff works underneath. I don't like too many magic tools. I need to understand enough about it to be able to diagnose and work around failures.
I have no qualms about using the tools though. I definitely want the jackhammer and the power armor! I want auto completion. It's awesome. It makes me so much more capable to quickly be productive in an unfamiliar code base or framework (if naming is sane ;)). If I don't have it? Sure I'll read the API docs and swear under my breath. Happens every time I gotta work on our python code. Could I do it better by having it in my working memory? Sure but I don't work with that code often enough for it to make sense to keep in memory (or learn in the first place).
I'm not saying we'd be better off without optimizing compliers, but I do think every programmer should have practical experience taking the lid off and poking around inside.
One is a rare and occasionally extremely useful skill, the other is basically a party trick, like being able to recite the Illiad from memory.
Assistive technology is the result of historical progression, so why eschew auto completion because it might fail when you don’t eschew your computer which might fail as well? Should we all just be programming on pen and paper because that’s lower down the progression stack and has less chance of failing? You know that argument was probably made in the 70s by some old school programmer when those fancy new interactive terminals started coming out (I believe dijkstra actually said something to this effect, but can’t find a source).
Yes. Not because of the resiliency (it's hard to imagine a failure mode where pen-and-paper programming would be the only option) but because it makes you better at your craft.
It's also insincere: do you regularly write out code with pen & paper? No, of course not. Nobody does. Just like nobody reads all the fine print, checks the emergency exits every time they enter a building, has an emergency drinking water reservoir, or a go-bag for volcano emergencies: these are teenage fantasies of what grown-up life should be like. Believing and propagating these ideas only sets you and your listeners up for failure.
Similarly, if you want to occasionally exercise programming without assistive technologies, more power to you. But if you're tying one hand behind your back while your goal is to actually produce useful code, then you're just being silly. Might as well use a screen reader instead of looking at the screen, or literally tying one hand behind your back.
In your weight lifting case, the goal is to maximize effect individually in your body. Here, the work of your body is the point.
It’s the same when writing programs: when at home, do whatever you want, but in a job, efficiency is key.
(Back to the subject at hand: I doubt whether ligatures help or hinder much, efficiency-wise)
How about it's fine, as long as I can still put my cursor in between the two underlying characters (edit them separately), and the resulting digram doesn't look so different as to be distracting?
I also like my code colored/beautified/ligtured.
P.S. I too wear glasses and you know what? I'd rather be able to see well without having to wear them. Alas, the technology is not yet here (well, it is, but I was told the chances of complications that could leave me completely blind were about 20% so uh, I'd just wear glasses even though they're quite a nuisance to wear with a face mask).
On the other hand, if you actually parse the input and use it to make transformations, it would be possible to show you what the tool your are inputting to believes you mean in a clearer fashion, which is very useful. Automated indenting and syntax highlighting (when done correctly) can catch errors as you type.
Ligatures don't necessarily stand in the way of this. It's a matter between the font and the syntax.
However, all that said, if you ever check in unicode identifiers that I can't easily type then you're on your own.
(It was for a personal project and I'm not sure I'd do that in a team environment, but I'd at least ask the other developers if they'd like it. And of course one use of Unicode being good doesn't mean that all uses of Unicode are good.)
Between copy and paste and most language's auto-complete tools and the emoji soft-keyboards in most operating systems today you can "easily type" most any unicode identifier with just a little bit of knowing your tools. (The Windows emoji keyboard has almost all of the Unicode math symbols, for instance.)
Both arguments ignore the 99.9999999999% of times ligatures do what they’re supposed to, and help me identify some symbols quicker. I’ll happily accept being confused once in a year about a strange-looking arrow in a debug log output, or from a weirdly rendered arrow in some ASCII art print.
People complain about weird stuff.
I first ran into this issue trying to learn Haskell, where some beginner websites used fonts like Fira Code in their listing. The "weird" operators I saw in the listings were unclear to me. In some cases I simply wasn't sure how to even reproduce the code in my editor. I think it is something I could grow used to and someday perhaps even enjoy, but as a beginner it was a barrier.
Also most of the lists of intentionally ligatured operators are pretty small and easy to find reference materials for. For instance Fira Code's big first chart in this section: https://github.com/tonsky/FiraCode#whats-in-the-box
* The operators do indeed mean the mathematical symbols
* Haskell does not support unicode in operators normally. The operators are ascii.
* I have yet to come across where the ligatures were wrong for my code and as I do not have those unicode operators in my code (and am not really sure how to type them) they were never ambiguous.
I am happy to have ligatures in Haskell. A colleague of mine programs in Agda though, which supports unicode operators and they have their mathematical meaning there. So he's fine without ligatures and does indeed type the unicode symbols using vim. It really depends on the language.
> (1) They contradict Unicode. [Goes on to mention U+FB01 LATIN SMALL LIGATURE FI and how a ligature for U+003D EQUALS SIGN, U+003E GREATER-THAN SIGN is indistinguishable from U+21D2 RIGHTWARDS DOUBLE ARROW]
No. Nonono. Hell no, one might say. (I’m frankly disturbed to hear this said by a typography expert, because this means something is deeply wrong, perhaps with my understanding here.)
It was never a goal of Unicode to have a code point for every ligature a typographer might ever want. For example, there is a code point for FI and for LONG S T, but not for FJ or FT. Like other “presentation forms” (a thing that Unicode is explicitly not supposed to contain), these exist only for roundtrip compatibility with old encodings (some ancient Adobe-Latin variant maybe?) and are deprecated for any other use (although I’ll be damned if I can find a clear statement to that effect on the Unicode website, there are notes in other places[1]).
The second part holds water to some extent, but given the amount of visual ambiguity afforded by allowing a text to contain arbitrary Unicode (which we must if U+21D2 is at all a consideration), no programming font can solve it, and no programming font tries.
[1]: https://twitter.com/fakeunicode/status/945017346858532864
As with so many problems in encoding anywhere have a single well renowned crazy source: some EBCDIC code pages had manually laid out ligatures.
(IBM's shadow remains a heavy one.)
In my mind it depends on where you are on the spectrum, the hardcore programmers that are one with the code and want to see every letter in a terminal editor and those that stray more towards the designer and practical side of programming. Just do what works for you, and get burned, otherwise you don't learn but endlessly follow "best practice" advice.
I do something much weirder, I program in proportional fonts. Once you get used to it it's really lovely. Unfortunately the way I figured out how to do it requires some aggressive reformatting of code (mostly using tabs instead of spaces) which makes it hard to share code with others unless they buy in to your preferences.
Ligatures can be nice if you can solve the edit problem: keeping an -> as two characters even if it looks like → can help a lot. Unfortunately, editors don’t do that, so they become too annoying to use (maybe when we render code like we render latex will it be accepted).
VS code does it at least, if i'm interpreting you correctly. You can position your cursor in the middle of the ligature and change either side
It’s strange to me how the OP is so laser focused on ligatures being “bad” because they violate Unicode. Coding up novel solutions is a stalwart of what it means to be a capital ‘H’ Hacker! I’m almost offended on a cultural level that they couldn’t at the very least appreciate the spirit of ligatures in programmer fonts.
Personally, I’ve never experienced a situation where Fira Code was the cause of of an ambiguous syntax or Unicode issues. But if they have, why not come up with a solution instead of being a hater?
Fortunately Firefox still supports user styles. Here's how to stop the madness for anyone that cares. https://winaero.com/enable-loading-userchrome-css-userconten...
Inside my userContent.css I've got this gem.
* { font-variant-ligatures: none !important; }For example, the author uses Fira Code[0] as an example of well-intentioned by problematic ligatures. The author says this is bad because (1) it contradicts unicode and (2) the substitutions will be inappropriate sometimes.
(2) is solved by applying substitutions in semantically relevant places with the syntax highlighter. This would be particularly useful when typing special sequences. If you get the ligature substitution, then you know you don't have a typo.
(1) is trickier. You want to save a unicode file, and you want to be able to copy text selections that end part way through a ligature. This requires some finesse.
Agree that it may be nice if they were more syntax aware. Although, I'm not sure what I want to have happen if I comment out some code.
The points on Unicode and wrong substitution feel weak, because there's plenty of valid situations where Unicode isn't displayed "correctly," and plenty of situations where the characters displayed don't match they semantic meaning.
In my opinion, the main reason to avoid ligatures isn't some big moral issue on "correct meaning" or "properly using Unicode." The main issue is that ligatures can cause confusion if the reader doesn't know the ligature (which is most readers).
For what it's worth, I like using font ligatures on my own IDEs. I think they look nice. But I would never choose them for anything displayed for anyone else.
> “What do you mean, it’s not a matter of taste? I like using ligatures when I code.” Great! In so many ways, I don’t care what you do in private. Although I predict you will eventually burn yourself on this hot mess...
Also note the ending line:
> If you don’t believe me, try it for 10 or 15 years."
Well, ligatures has soon been in ten years or more in programming fonts.
In many ways, the article has a good point, don't use ligatures in public code.
It has second point too, which I think is not true: If you use ligatures, you may write logical bugs by twisted semantics. This is a statement, which would require statistical study on programmers who use ligatures and who doesn't. Do they write more bugs or not?
I find some ligatures very helpful for readability, and thus they actually reduce bugs, but it's all in the eye of the reader.
It's not like they're hard coded somewhere, they're a matter of personal preference, just like spaces/tabs and fixed-width fonts.
It's just the author's preference in rant form, nothing more.
For the most part. I used a beginner Haskell book for some course. And they used the proper symbols for some operators. But then newbies might think that the symbols used in the book is what constitutes what raw Haskell looks like, which is wrong. So that’s very inappropriate.
On the other hand, this is not the same as using ligatures to display things like `==` in an editor; the former is text substitution, while the latter is purely a visual thing. And I am fine with the latter as long as it is not misleading.
These visual ligatures are the closest thing that most languages will get to using “nice-looking” (subjective) symbols instead of just every combination of all the printable ASCII symbols. Now, using Unicode in some new tech is intrusive since that is a decision that affect all users of that tech. The author of this piece did do that in his Pollen by using U+25CA LOZENGE (`◊`) as the central metacharacter. I don’t know how that panned out since I haven’t used that very interesting typesetting language.
Modern/new languages might want to loosen up on the aversion they have towards Unicode. But it’s a chicken and egg problem: input methods suck so most languages don’t want to burden their users with having to use symbols that don’t show up on their keyboards. And in turn input methods suck because we often don’t need anything better (at least us who are monolinguals and/or from the West). Maybe the best that languages that want to use Unicode can do is to provide Unicode symbols as an alternative by making sure that some ASCII soup can always be used instead (kind of like C’s trigraphs…).
I guess ligatures are fine by me, I use them and have not been bitten. Editors should rather focus on showing whitespace somehow, I have been bitten by tab/space/CRLF many times!
And of course it has no chance of understanding .ne. but that's fine.
In LaTeX lstlisting you can sometimes get weird little underlines to explicitly show spaces in code. It looks pretty bad!
I almost want a font that draws l as a lower case cursive l, although I guess it is probably better not to fix this problem as somebody out there will have a font that mixes them up.
Programming languages' operators like == are actually ASCII arts for the convenience of the machines, never the humans. It is encoding a concept that is not representable in ASCII, so it has to be encoded by a conventional combination of two characters. When reading your own or others code, you have to do this subtle mental labor of decoding the ASCII art back to the concept.
Programming ligatures, on the other hand, alleviate this burden. They conform the intended meaning of the author. It's not a typographical problem, rather it's a communication problem.
For most ligatures, you can guess the underlying ASCII codes, and if you can't guess, you only need to learn once. In an editor or on a webpage, you can copy the code and paste onto something that doesn't have the ligature font enabled to learn its components.
The idea case is Unicode programming like Agda, but it has its own problems like not easy to type and find out how to type, lacking some operators, hard to read with small font size, etc.
Ligatures are a balanced option between the ASCII art and the Unicode programming. Not hell yes, but neither hell no.
if you’re preparing your code for others to read—whether on screen or on paper—skip the ligatures.
I can agree with this.I also agree with another comment that I don't want my ":)"s being converted into emojis. And the ligatures look pretty good, but I wouldn't use them when programming.
Much as colored syntax can go very wrong with a poor color palette, mappings, or monitor color profile, ligatures go wrong enough not to make it worthwhile. Maybe they'll get sorted out eventually as we have good color defaults these days.
Ligatures in Programming Fonts: Hell No - https://news.ycombinator.com/item?id=19805053 - May 2019 (86 comments)
Basically, I find it very distracting when typing something and then seeing something else appearing around my typing. Ligatures definitely fall in that “distracting” realm for me. It may not be as pretty but I like the symbols showing exactly as I typed them.
I don’t begrudge others who like these —- it’s their preference. I just prefer non-ligatured versions of coding fonts.
In many code editors (even my terminal with fish shell!) this is not true. Ligatures are broken up when the text changes style due to syntax highlighting. Syntax highlighting can consider context, so if there is a mistaken ligature, this can be fixed by changing the syntax highlighting rules.
Discussed at https://news.ycombinator.com/item?id=20728715
For example {| might be paired with |} as special quotation syntax, at any rate some form of bracket. See, Fira Code has a ligature for those.
But in Ruby you'd see one of them in one liner blocks, e.g.: list.map {|x| x*x}
Here {| is not a thing that should be combined. It would look really confusing as you'd search in vain for a corresponding closing special bracket. { and } denote the block and | and | the argument(s).
How symbols are combined to form meaningful units depends on the syntax of a language and this issue cannot be avoided. So your milage may vary.
I'd be on board more if ligatures were applied in a language specific way, aware of the meaning of tokens in context, e.g. to leave <= in string literals alone, render it ⇐ when used as an arrow (maybe in a language that has left arrows), and something like ≦ when used in a comparison context.
But the same thing being rendered in different ways may be very confusing (unless there's an easy on/off toggle).
It has ligatures... which I don't enable.
I've found the blog posts on the designs of each to be interesting.
Ligatures, on the other hand, don't hurt anybody else.
Also: I would probably never use your font, as I think ligatures look amazing.
And I have never encountered a single case of your objection #2.
Does this mean I will stop using lig? Nope.
But if he was, it would be OK, no?
Ligatures and substitutions are display only.
I can setup my ide to display how I want it to display code. It affects no one else.
Why should any manager dictate that to me? I'd not be working for someone like that. Feels that it would be someone on a huger power trip.
Imagine dictating what font your Devs have to use... That would be mental.
It's called "discourse". Differing opinions are voiced and compared to each other, not in search of "Universal Truth", but because different things work better or worse for different people. Greater awareness of the scope of possibility allows individuals to find the things that work best for them. Society as a whole benefits, eventually; at the cost of lots of noise... which we seem to have regardless.
Either you like them or you don't and it doesn't affect anyone else's machine. It doesn't matter if it's pure Unicode or whatever loosely connected complex faux objective reasoning you can drum up to support your subjective view.
I didn't like them, but then I did get used to them and I prefer them for JS/TS (only FiraCode's specifically), let me stretch that into an article...
tl;dr: you can obviously do whatever you want, but when you interact with others, having more things in common helps the transfer of information and knowledge.
Take a super-personalised 'pretty' keyboard with a custom layout. That's great if you have a desk that is yours where only you sit, and you never sit anywhere else. The reality is that you aren't guaranteed to be the only one there, and you're also not guaranteed to be always there when you are writing. So now you have to either have a backup-keyboard or have lower performance for yourself or others that use your desk.
Same goes for the way you like your shell, when you configure it in such a way that it no longer represents anything that looks like a default distro shell, your examples may no longer work for others. Examples of others might no longer work for you. You, using a shell on another system might no longer be familiar to you, and when you have someone looking at your work (be it a presentation or co-worker) they might have a hard time understanding what you are doing at all.
This also goes for fonts, color schemes, menu configurations, even the desk, chair, monitor or network you are using.
None of that means you shouldn't use what works well for you, or that you shouldn't do whatever you want when it doesn't interact with others, but in reality you never really work in isolation, and as soon as you need to interact with something that isn't yours or someone needs to understand what you are interacting with in your setup the flow of information is quite influenced by the presentation based on your preferences.
That doesn't mean that everything and everyone needs to be the same either. If you work on a software project together with others, you probably have a coding standard and editorconfig that embody the commonalities, and then it doesn't matter if someone is using neovim, babi, IntelliJ or ed. But if you end up on stage somewhere showing your work to a larger audience, having an editor that is familiar enough to not distract or confuse, a shell that looks like the shell the audience might be familiar with and a font that people don't need to "interpret".
You can replace stage with any other form of sharing, including screencasts, screenshots, books, websites etc.