UTF-8 Unicode operators vs digraphs

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Aug 12 09:29:51 UTC 2026


On Tuesday, August 11, 2026 11:34:00 AM Mountain Daylight Time Dlighted via Digitalmars-d wrote:
> I think especially digraphs like >= <= != are a relict of the
> past.
> They are stand-ins for ≥ ≤ ≠ just like C has for many other now
> common symbols. I'm supposed to do mental gymnastics and visually
> overlap the symbols to see the actual symbol.
>
> Until C23:
> ??=   #
> ??/   \\
> ??'   ^
> ??(   [
> ??)   ]
> ??!   |
> ??<   {
> ??>   }
> ??-   ~
> Since C 95:
> <:    [
> :>    ]
> <%    {
> %>    }
> %:    #
> https://en.wikipedia.org/wiki/Digraphs_and_trigraphs_(programming)
>
> Keeping the old for compatibility and ease of typing makes sense
> but it doesn't really make sense to force the old ones.
> Is != /= ~= -ne <> really better than ≠? (Okay, I haven't used
> Haskell yet. I'm strawmanning.)

Those symbols are not on a typical keyboard, which would make them a royal
pain for most people to deal with. It's far easier to program when all of
the relevant symbols can be trivially typed without having to figure out how
to access symbols which are not natively on the keyboard.

And honestly, I don't see any problem with the symbols that D currently uses
for comparisons. They're quite standard and well understood. I don't see how
using Unicode symbols instead actually adds any value when the current
symbols work perfectly fine and are easy to type.

Personally, while I agree that it's good that D natively supports Unicode,
as a general rule, I don't think that even non-ASCII identifiers should be
used, because it makes the code harder to maintain. Maybe it makes sense to
use Unicode identifiers with a proprietary codebase where everyone involved
is using something like a Japanese or Russian keyboard, but for open source,
it generally causes problems to use identifiers which are not ASCII. Having
operators which aren't ASCII would be even worse.

- Jonathan M Davis






More information about the Digitalmars-d mailing list