5 ms·
To clarify, I’m not talking about ligatures in programming fonts here. I’d like to use a slightly wider set of Unicode characters, for their designated purposes
by Chris_Newton 2y ago
To clarify, I’m not talking about ligatures in programming fonts here. I’d like to use a slightly wider set of Unicode characters, for their designated purposes, as the main and only way to write those ideas. This could include comparison operators, arrows, maybe a few other common and easily recognisable operations.
I would like to use those same characters, and where applicable with the same sizes and alignments of related characters, everywhere — in my editor, my linters and formatters, my diff tools and version control system UIs, my greybeard CLI text file batch processing incantations, everywhere.
All that really needs is languages that use Unicode characters like ≤, fonts that include all the relevant glyphs, and tools that provide a simple way to enter those characters. But all of these are important, because right now we don’t have simple, standardised ways of doing these things, and so we mostly don’t do them at all.
It’s obviously not a big deal, just a small “quality of life” improvement, but it’s 2024 and I don’t see any good reason why we can’t have nice things. :-)
- teo_zero 2y agoThe C committee has just deprecated trigraphs. It might be the right time to propose ≠ as alternative to != and then in 40 years we can deprecate != and only keep ≠
- satiric 2y agoHow would you type those characters? For me (on mobile) I have a few options: copy it from your message, or google "not equals sign" and copy from the browser, or add a new keyboard that contains the character. On my desktop, I could also memorize windows' alt+x code... none are fantastic options.
- teo_zero 2y agoOn mobile I keep "=" pressed for 1 sec and it allows me to type ≈ ≠ and ≡. On Linux I use the sequence Insert, "/", "=", having mapped Insert to act as a Compose key (what other use do you have for it anyway?). On Windows I use the same sequence, having installed wincompose by Sam Hocevar.
- swiftcoder 2y agoThe long and the short of it is because most keyboards don't have dedicated keys for such characters. Ligatures are here, today, and everyone can make use of them. Rich unicode characters require input method changes that are custom to every platform (and likely need to be customised for each international keyboard layout as well). This is not a hypothetical, btw. One of the most persistent friction points for C++ adoption in Europe was the lack of a ~ (tilde) key, forcing folks to ALT-1-2-6 every time they wanted to implement a destructor...
- Chris_Newton 2y agoI appreciate that there is a barrier to adoption here. On the other hand, we’ve had office software that autocorrects -- and " to their more typographically savvy counterparts for a very long time. In many places, people use modifier keys much more than we do in the English-speaking world to type the wider set of characters used by other languages. Many platforms offer methods like compose keys or Unicode look-ups for entering special characters and plenty of people use them. I’m fairly sure that if code editors started offering to convert >= into ≥ automatically then the developers using them would figure it out!
- swiftcoder 2y agoI guess I'm unclear why (contextually) auto-converting >= into ≥ is objectively better than just (contextually) displaying >= as ≥? Seems like it accomplishes exactly the same thing
- Chris_Newton 2y agoJust because using the real characters is unambiguous and has the same size/alignment everywhere. I’d prefer to use those real characters because they are more compact and consistent, but it’s a small thing, so IMHO it’s only worthwhile if the whole team sees the same thing and in all of the tools we use. Relying on ligatures in coding fonts doesn’t achieve the latter and often doesn’t achieve the original goal either, so while some might enjoy them, it’s not the solution I’m looking for personally.