News for hackers. Stuff that matters.
Re:What’s New in Python 3.8 by BurningFrog on Monday October 14, 2019 @06:42PM (#21253644)
> 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!

Re:What’s New in Python 3.8 by robocat on Monday October 14, 2019 @07:08PM (#21253846)
There 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.

Re:What’s New in Python 3.8 by ken on Monday October 14, 2019 @11:22PM (#21255284)
> 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!

Re:What’s New in Python 3.8 by grincho on Monday October 14, 2019 @08:10PM (#21254269)
The 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.
Re:What’s New in Python 3.8 by robocat on Monday October 14, 2019 @08:49PM (#21254490)
That'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).

Re:What’s New in Python 3.8 by macintux on Monday October 14, 2019 @10:38PM (#21255111)
The 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.
Re:What’s New in Python 3.8 by macintux on Monday October 14, 2019 @10:41PM (#21255125)
I 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).
Re:What’s New in Python 3.8 by cpach on Tuesday October 15, 2019 @04:12AM (#21256478)
Cool! Where do I find it?
Re:What’s New in Python 3.8 by macintux on Tuesday October 15, 2019 @09:22AM (#21258049)
In Mojave, and it’s pretty similar across versions IIRC: open keyboard preferences in system settings and check the “Show keyboard and emoji viewers in menu bar” box.

That will replace the language flag icon in your top bar with an odd icon with the command key embedded.

The second option in that menu is the keyboard viewer. You can show that and drag on a corner to make it as large as you want. Dynamically changes the keyboard as you hold down modifier keys.

Re:What’s New in Python 3.8 by kps on Monday October 14, 2019 @10:02PM (#21254926)
It'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.
Re:What’s New in Python 3.8 by kps on Tuesday October 15, 2019 @11:14AM (#21259287)
Self-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.)

Re:What’s New in Python 3.8 by Kwpolska on Tuesday October 15, 2019 @02:28AM (#21256024)
I've hacked /usr/share/X11/xkb/symbols/xx files to have custom keyboard layouts, DEs are not able to mess with it.
Re:What’s New in Python 3.8 by kps on Monday October 14, 2019 @09:55PM (#21254880)
X has Compose, which originated slightly earlier (the key, that is, not the X11/xkb implementation), and is a tolerable alternative. e.g. [Compose / =] ↦ [≠]
Re:What’s New in Python 3.8 by thaumasiotes on Tuesday October 15, 2019 @01:42AM (#21255836)
> nice mnemonics like these:

> option-w ∑

This would grate on me every single time I had to use it. It's an S. Put it on option-s.

Re:What’s New in Python 3.8 by uranusjr on Tuesday October 15, 2019 @02:33AM (#21256044)
For context opt s is ß so the decision wouldn’t be easy if you want to include both.
Re:What’s New in Python 3.8 by thaumasiotes on Tuesday October 15, 2019 @01:48PM (#21261426)
What are á and à?

Putting double S on option-s just makes option-w for Sigma more grating. If they were going by shape, it'd be on option-b, which is equally stupid. But since it's on S, we can conclude that... someone at Apple knows German, but nobody can even name a Greek letter? That Germans are right and Greeks are wrong? What?

Re:What’s New in Python 3.8 by uranusjr on Tuesday October 15, 2019 @03:02PM (#21262365)
I don’t think it that extreme, but that German has higher precedence than Greek. If you need to include both characters, you have to pick one or the other, and for whatever reason this configuration happened. We might never know the true reason behind the decision, but stupility is unlikely the answer. Most seemingly stupid decisions (technical or otherwise) makes at least a certain amount of sense within its proper context, and it’s fair to talk down to it when you don’t have the risk of being judged by that decision.
Re:What’s New in Python 3.8 by thaumasiotes on Tuesday October 15, 2019 @03:37PM (#21262761)
I repeat:

> What are á and à?

The concept of variations on a common letter wasn't exactly new at the time. If you're supporting German and Greek, it seems safe to say you're also supporting French.

Re:What’s New in Python 3.8 by Kwpolska on Tuesday October 15, 2019 @02:31AM (#21256034)
Windows has a keyboard called US-International with extra symbols. Also, note that those key combinations might not exist in other keyboard layouts (replaced with local keys).
Re:What’s New in Python 3.8 by Razengan on Tuesday October 15, 2019 @09:27AM (#21258103)
I like to use characters like those as custom operators whenever I can. :)
Re:What’s New in Python 3.8 by Sean1708 on Tuesday October 15, 2019 @03:40AM (#21256344)
> 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.:!=

Re:What’s New in Python 3.8 by amedvednikov on Monday October 14, 2019 @11:30PM (#21255316)
I'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

Re:What’s New in Python 3.8 by jfim on Monday October 14, 2019 @07:03PM (#21253803)
Many 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.
Re:What’s New in Python 3.8 by VVertigo on Monday October 14, 2019 @06:58PM (#21253759)
I’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.
Re:What’s New in Python 3.8 by Pxtl on Monday October 14, 2019 @07:17PM (#21253917)
Oh 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.
Re:What’s New in Python 3.8 by roywiggins on Monday October 14, 2019 @10:29PM (#21255062)
Re:What’s New in Python 3.8 by gunn on Monday October 14, 2019 @10:31PM (#21255071)
Re:What’s New in Python 3.8 by codebje on Monday October 14, 2019 @08:37PM (#21254425)
Check out Lean Prover's online editor: 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.

Re:What’s New in Python 3.8 by PeCaN on Monday October 14, 2019 @07:44PM (#21254096)
a lot of programming fonts have ligatures for this