UTF-8 Unicode operators vs digraphs
Timon Gehr
timon.gehr at gmx.ch
Wed Aug 12 11:52:44 UTC 2026
On 8/11/26 19:34, Dlighted wrote:
> The site told me I should make a new thread rather than replying to a
> years old one. Forgive me if I made a completely useless offtopic thread
> that wasted everyone's time.
> I thought about Unicode operators multiple times over the years and it's
> been mentioned on the D forum more than once:
> https://forum.dlang.org/thread/nujfnoneihykkkfzeeaj@forum.dlang.org
> https://forum.dlang.org/post/ahxrzlvznpdutwvvmlfv@forum.dlang.org
> ...
>
> Personally I can in fact type some math symbols on my keyboard layout
> natively on higher layers without using compose. ¬ ∨ ∧
> And every Linux user (like me) can use xcompose by pressing the compose
> key or shortcut. My xcompose also has some already predefined. >= <= /=
> turn into ≥ ≤ ≠.
> There are also third party keyboard layouts and IMEs for Windows. I have
> used one and it worked fine.
> Maybe code formatters could convert to them too.
> ...
I am just using an emacs input mode. Plugins also exist for other editors.
My own language has Unicode operator support (though it's fully a
formatting choice, everything has an ASCII alternative). It has been an
uphill battle. E.g., see:
https://www.reddit.com/r/programming/comments/i4uavw/meet_silq_the_first_intuitive_highlevel_language/
https://www.reddit.com/r/programming/comments/ii4t0r/meet_silq_the_first_intuitive_highlevel_language/
Instead of discussing what is interesting about the language, a good
chunk of the comments are just low-effort anti-Unicode-syntax posts.
It's not considered sufficiently "normal" and people like writing snarky
comments, so you always get a lot of spam whenever you are trying to
share something.
One reddit user put it best:
"I feel dump. Can't understand what's going one how the syntaxt work."
Also, one drawback of the Unicode syntax design has been that e.g.
OpenAI ignores 𝔹 when reading HTML pages, so GPT is actually not able
to read documentation if it is written with Unicode. It is very adamant
though that the syntax is `x := 0:;` and `x := vector(n, 0):^n` instead
of `x := 0:𝔹;` and `x := vector(n, 0):𝔹^n`. Arguably this part would
probably not happen with symbols D is likely to use.
> ...
> Personally I find && quite ugly too. ∧ ∨ for && || are more readable. I
> know Walter doesn't like the keywords _and or not_ because they've been
> used as variable names.
I think `∧` and `∨` I think are not great choices for `&&` and `||`,
because `&&` and `||` are short-circuiting operators. Then `and` and
`or` don't match either, for the same reason (though I guess Python does
this anyway). One alternative I have seen that actually makes sense is
`and then` and `or else`, but it's a bit verbose.
> I read it somewhere on the forum. But I guess
> that would be too controversial for people who don't know math well. I
> actually like the words but I use a Germanic language, so I'm naturally
> biased whereas math is universal.
> ...
Short-circuiting is not universal.
> However the symbols ≥ ≤ ≠ would be an undeniable upgrade. So, uh ...
> **Why not?**
> ...
In my experience: Humanity is not ready for it, it will blow people's
minds and break people's pet software, even if it was written in 2026.
Not a reason not to do it, just a reason why I predict it will not
happen anytime soon in D.
More information about the Digitalmars-d
mailing list