5 ms·
> which itself is a result of limiting ourselves to the ASCII symbols that can be typed I think we're ready for programming languages using some visually good
by BurningFrog 7y ago
> which itself is a result of limiting ourselves to the ASCII symbols that can be typed
I think we're ready for programming languages using some visually good Unicode characters, instead of overloading `[]{}!@#$%^&*()-_/` for everything!
- VVertigo 7y agoI’ve been looking at making up a second keyboard with a bunch of useful characters on it (similar to Tom Scott’s unicode keyboard) and learning Perl 6 to make use of it. I’m thinking that’s going to be my Winter Project/New Year’s resolution this year.
- jfim 7y agoMany languages allow that. Scala allows characters in the math symbols (Sm) and other symbols (So) Unicode categories as identifiers for functions and variables, and APL has a rich notation that relies on many single character operators.
- robocat 7y agoThere are programming fonts that use ligatures to convert >= to ≥, or -> to →, so the source code remains in ASCII but symbol sequences show as unique Unicode characters. A next step could be for common dev environments to actually convert symbol/key sequences to operators (how do APL programmers do it?) Avoiding ambiguity and semantic overloading of ASCII symbols would surely help beginners (if also given a UI that clearly exposes ways to enter the new symbols). I always find one letter operators extremely strange too like u"word" s/foo/bar/ etc. It seems a shame we can type in hundreds of Unicode symbols on a mobile virtual keyboard, but not readily on a physical keyboard. JavaScript has supported Unicode for a long time, but the core language doesn't use it at all.
- grincho 7y agoThe Mac has provided easy access to symbols since 1984, with nice mnemonics like these: option-= ≠ option-< ≤ option-> ≥ option-/ ÷ option-o ø option-w ∑ I don't know why other OSes haven't adopted something similar. The first couple of these were even idiomatic in HyperCard's scripting language.
- robocat 7y agoThat's like visual puns, and is limited to whatever symbols seemed important to the developer at the time. How do you discover how to type ß, °, «, ‡ etc? Android's gboard uses phonetics (long press [s] key for ß), symbolic similarity (long press [*] key for ‡) and visual similarity (long press [<] key for «) which is guessable for some symbols, but isn't discoverable for others (you can search for emoji by name, but not symbols).
- kps 7y agoIt's easy on the Mac to have a custom or purpose-built keyboard layout that makes sense for the user or context. It's a little harder with X (mostly due to uncoöperative DEs) but still doable.
- Kwpolska 7y agoI've hacked /usr/share/X11/xkb/symbols/xx files to have custom keyboard layouts, DEs are not able to mess with it.
- kps 7y agoSelf-reply for Kwpolska: Adding layouts to /usr/share/X11/xkb/symbols/ is straightforward (but is necessarily system-wide, and requires root), and I do that. However, for the popular desktop environments, it's like pulling teeth to have that layout treated as first-class with respect to switching and settings. (On MacOS, putting a .layout file in ~/Library/Keyboard\ Layouts is enough.)
- macintux 7y agoThe Mac has had, as a standard feature for decades, an on-screen keyboard to allow you to explore the results of different key combinations. It’s a great tool.
- macintux 7y agoI should note that, alongside it, is a useful search tool that allows you to find the character you’re looking for if you’d rather just search and don’t care to learn the key combination (if there is one).
- ken 7y ago> There are programming fonts that use ligatures to convert >= to ≥ It's a neat hack, but that's the opposite of what I want. It means I can't look at source code and know what characters make it up, which is the primary reason I'm still putting up with plain text files (and mostly ASCII) for source code at all. Out of habit, I occasionally type some control-letter combination which is a valid command in Emacs, but in Xcode (and other native Mac apps) inserts an invisible character, which happens to be invalid in Swift. 10 minutes later, I get a compilation error pointing at a line of code that looks perfectly valid. Frustrating!
- Pxtl 7y agoOh god, this. I want a language that as I type, != Gets replaced with a proper ≠ not equals sign and proper symbols for AND, OR, and NOT.
- PeCaN 7y agoa lot of programming fonts have ligatures for this
- codebje 7y agoCheck out Lean Prover's online editor: https://leanprover.github.io/live/latest/ https://leanprover.github.io/live/latest/ They borrow syntax from LaTeX math-mode to allow symbol entry, such that you can type "\ne" and as soon as you hit the space after the "e", you get ≠ instead. The language plugin for Visual Studio Code does the same thing. Lean Prover's not exactly a programming language, but : def foo (a b : ℕ) : ℕ → ℕ → ℕ := λ a b, a + b Still looks decent. I think it has to be all or nothing though, since if it's optional the odds of getting decent editor support for it is low.
- roywiggins 7y agoUse a ligature font! https://www.hanselman.com/blog/MonospacedProgrammingFontsWithLigatures.aspx https://www.hanselman.com/blog/MonospacedProgrammingFontsWit...
- gunn 7y agoHere you go: https://github.com/tonsky/FiraCode https://github.com/tonsky/FiraCode
- amedvednikov 7y agoI'm experimenting with this in V [0] if a ≠ b { is allowed along with if a != b { vfmt (kinda like gofmt) will be able to convert != to ≠. So far the response has been mixed. Not everyone is open to this change. [0] https://vlang.io https://vlang.io
- Sean1708 7y ago> I think we're ready for programming languages using some visually good Unicode characters Some already do: https://docs.julialang.org/en/v1/base/math/#Base.:!= https://docs.julialang.org/en/v1/base/math/#Base.:!=