Unicode offers many symbols that make beautiful names for operators, but in addition to the usual problems (they're hard to identify with their ASCII equivalents, and almost impossible to type, and they become unintelligible when encodings get confused) there's a rendering problem: rare characters are often displayed poorly, because most fonts don't cover them very well.
I encountered this recently in one of Conal Elliott's posts which uses the character ↛
. The font I saw it in didn't contain that character, so it was rendered in some other font, but scaled wrong, so it was illegibly small. I had to triple the font size to figure out that it was supposed to be a slashed arrow, not a squashed gnat. Amusingly, a change note on that post says this character was a replacement for another that was even more badly rendered:
2011-01-31: Switched trie notation to "k ↛ v
" to avoid missing character on iPad.
Even fonts that have a character may not render it well. The composition operator ∘
(which also appears in that post) is one of the best candidates for a non-ASCII name, because it's so well known and has no good ASCII equivalent. Unfortunately, all the fixed-pitch fonts on my machine display it too high and with too much space on the right, making it look more like the degree sign ° than composition. Making a font with good glyphs for 95 ASCII characters is not prohibitively difficult, but making one for a few thousand Unicode characters is apparently a challenge even for the professionals.
Unfamiliar operators like the trie constructor aren't very compelling candidates for symbolic names anyway, so it's not much of a loss to use ASCII for them, but it's sad that we still can't use the familiar symbols for composition and set membership. (Although composition may be moot — I tend to write it as .
even on paper, because of Haskell.)
Are you tempted to use 'λ' for lambda?
ReplyDeleteAs you probably know, Racket encourages the use of 'λ' (at least, it devotes a menu item to it, although of course it allows 'lambda' as a synonym).
I use λ (or the less readable →) in writing, but the awkwardness of typing it means I'm not very tempted to use it on screen. It might be different if I were accustomed to having a convenient keychord for it (as in DrRacket).
ReplyDeleteλ is also sometimes jarring to read on screen, since different scripts don't generally look alike even within the same font.
The display problem is pretty much solved. The keyboarding problem is not one bit solved (for those of us who don't have Knight keyboards, which is most of us), and that's why most of those Unicode characters languish unused in programs, and even Fortress has to have ASCII as well as Unicode input mode.
ReplyDelete