Live data from Hacker News

Ligatures in programming fonts: hell no (2019)

practicaltypography.com

1–10 of 201 posts

Re: Ligatures in programming fonts: hell no (2019)

#2
Much ado about nothing. It's a matter of personal taste. An actual ≠ has a low chance to sneak into the source code, even lower chance to somehow type it by hand. Either way, it would be a syntax error highlighted by any editor. I'd like my code to look nice and I accept the risks.

Re: Ligatures in programming fonts: hell no (2019)

#3
post #2

Much ado about nothing. It's a matter of personal taste. An actual ≠ has a low chance to sneak into the source code, even lower chance to somehow type it by hand. Either way, it would be a syntax error highlighted by any editor. I'd like my code to look nice and I accept the risks.

It's probably fine for you reading your code. It's not impossible it causes others reading your code some confusion when they render it with ligatures or receive eg pdf of it in ligatures, distinct from how it looks when they edit it.

Minor issue mostly.

I tend to "no", but for no very good reason: Aesthetically they're lovely.

Re: Ligatures in programming fonts: hell no (2019)

#4
I've witness many a question after/during technical slides where the audience was confused by symbols. At a bare minimum, don't use ligatures in slides or blog posts or anything meant for a broad audience.

Ideally, languages would support Unicode as well so you can mean what you say when you type—some folks will naturally prefer this to “keyboard-compatible” options and this should be fine (though ask many non-Anglophone users where the `$` key is and they won't be able to tell you). With Vim digraphs, Kitty unicode input, extra layers on a keyboard… there are many ways to tackle the ‘input hard’ problem. A good example of this is Dhall where Unicode is optional, but could be enforced with a built-in formatter option.

Re: Ligatures in programming fonts: hell no (2019)

#5
Related:

Ligatures in programming fonts: hell no (2019) - https://news.ycombinator.com/item?id=29637876 - Dec 2021 (195 comments)

Ligatures in Programming Fonts: Hell No - https://news.ycombinator.com/item?id=19805053 - May 2019 (86 comments)

Ligatures in programming fonts - https://news.ycombinator.com/item?id=14830797 - July 2017 (82 comments)

Re: Ligatures in programming fonts: hell no (2019)

#6
post #4

I've witness many a question after/during technical slides where the audience was confused by symbols. At a bare minimum, don't use ligatures in slides or blog posts or anything meant for a broad audience. Ideally, languages would support Unicode as well so you can mean what you say when you type—some folks will naturally prefer this to “keyboard-compatible” options and this should be fine (though ask many non-Anglop…

The initial presentation of Kotlin at Google I/O used fonts with ligatures. As a result, many people in the audience were confused about what the actual syntax of the language was.

Re: Ligatures in programming fonts: hell no (2019)

#7
There was one occasion when, by some unknown reason, >= rendered as > for me in browser. You increase/decrease font size and everything was ok, but I was extremely confused when colleague sent me a screenshot when after I commented in code review. Also there were issues with formatting of ligatures of some fonts in kitty terminal.

Other than that, ligatures are great and I will never turn them off.

Re: Ligatures in programming fonts: hell no (2019)

#10
I have absolutely no idea how many people might share print screens of their code, and how often some beast looking at these images might, because of that, find a way to discover how to type a similar looking symbol in unicode, enter it in their editor, and compile it without error, therefore introducing a subtle bug.

Luckily I rarely share my code through pdf, but mostly through git. Therefore, that hypothetical beast will read the code through its own editor, so the risk is mostly avoided. There is still the risk that this beast might appear behind my shoulders, see the pretty symbols and start that process anyway, but I have no idea how often that might happen too. It's a weird thing that this beast can do such an elaborate process, but not ask a question about what the symbols are.

For better arguments, there's a long history of problems with programming languages that use non-ASCII symbols as default, and it has been considered a mistake.

That crazy idea of 'letters' that look alike and thus introduce bugs is much worse with unicode than ligatures:

  >>> a = "hello world"
  >>> b = "hеllо wоrld"
  >>> a == b
  False
Example from "Unicode text spoofer": >This browser-based utility fakes regular characters in text and replaces them with Unicode characters from other alphabets. The text that you paste or enter in the input text area automatically gets all possible characters replaced with Unicode homoglyphs in the output. You can spoof letters, punctuation marks, spaces, and even insert zero-width spaces between individual symbols.

Now imagine instead of doing this, you use hello_world as variable name. You can thus interleave use of different variables that look alike, and have really buggy code.

Last argument, which is the one most important to me. Typing <= or != is ugly as shit. That is not how these symbols are supposed to look like, it's just a practical kludge. Ligatures are a simple solution to have both, that do not require a revolutionary way to change programming languages, and only engage yourself. To share print screens of code without ligature maybe configure a second editor with another font. That does not sound really hard...

Post reply on HN