3 ms·
Programming languages characteristically haven’t adopted Unicode syntax because Unicode input methods aren’t “there yet”. But if we start accepting Unicode in p
by evincarofautumn 9y ago
Programming languages characteristically haven’t adopted Unicode syntax because Unicode input methods aren’t “there yet”. But if we start accepting Unicode in programming languages, at least as an option with ASCII as a fallback, then input methods, searching, and so on will be forced to improve.
I currently use Emacs’ TeX input method, so I can type “\forall\alpha. \alpha \to \alpha” and get “∀α. α → α” or ”4.7k\Omega \pm 5%” for “4.7kΩ ± 5%”, which isn’t too bad. And in Haskell at least there’s Hoogle, which lets you search for unfamiliar operators, even Unicode ones. For instance, searching for “∈” gives me base-unicode-symbols:Data.Foldable.Unicode.∈ :: (Foldable t, Eq a) => a -> t a -> Bool and tells me it’s equal to the “elem” function which tests for membership in a container.
Using ASCII art instead of standard symbols introduces some cognitive load for beginners as well. When I was tutoring computer science in college, I had students get confused by many little things, like “->” instead of “→” (“Minus greater than? What could that possibly mean?”) or writing “=>” instead of “>=” because “≤” is written “<=”.
- FridgeSeal 9y agoI've been using Fira Code[0] which supports ligatures and (in addition to being a nice looking monospace font) it makes reading code with those symbols so much nicer. I mainly write Python and that generally uses a pretty limited set of special symbols, but it really does make a difference when you see ≤ rather than <= and 'long equals' instead of == etc. I definitely recommend it. I'd love to see ligature/unicode support rolled out more widely, symbols allow for more easy differentiation and they're so nice to look at when you do have them.
- evincarofautumn 9y agoI’ve tried Fira Code before, and I think it goes a bit too far honestly. It’s nice that it preserves character widths, but ideally I’d like to get away from monospaced fonts as well—they’re pretty much just a holdover from the technical limitations of typewriters and text displays. The main reason I don’t use proportional-width typefaces in programming is that I like to work in a text-only terminal (to avoid distraction) and that the ASCII-art approximations of symbols tend not to look very good.
- TeMPOraL 9y agoInteresting idea to have it solved in a font. For now, I've been using Emacs configured in a way to replace e.g. the word "lambda" with a symbol "λ" for display only - i.e. the original text stays in the text file, but on the screen, it gets rendered as a pretty version. I recall Haskell folks developed a lot of such replacements for mathematical symbols, too, but I can't get a proper Unicode font that would make them readable at the sizes I use (I prefer rather small text for code, so I can see more of it at the same time).
- sametmax 9y agoYou realize your whole comment is actually arguing in my favor right ?
- TeMPOraL 9y agoIt isn't. Recall the general rule of thumb: code is read many more times than written. Also related, most of the "code writing" part is still actually just code changes, which don't require as much typing from you.