UTF-8 Unicode operators vs digraphs
Timon Gehr
timon.gehr at gmx.ch
Wed Aug 12 23:12:12 UTC 2026
On 8/12/26 21:37, Walter Bright wrote:
> On 8/11/2026 10:34 AM, Dlighted wrote:
>> Until C23:
>> ??= #
>> ??/ \\
>> ??' ^
>> ??( [
>> ??) ]
>> ??! |
>> ??< {
>> ??> }
>> ??- ~
>> Since C 95:
>> <: [
>> :> ]
>> <% {
>> %> }
>> %: #
>> https://en.wikipedia.org/wiki/Digraphs_and_trigraphs_(programming)
>
> In my 40-some (cough cough) years of programming, I have never ever seen
> those trigraphs and digraphs appear anywhere other than a test suite.
> They were a complete failure.
> ...
I think they were worth it just for helping facilitate this wholesome
interaction:
https://www.quora.com/Are-there-really-programmers-with-computer-science-degrees-who-cannot-pass-the-FizzBuzz-test/answer/Gayle-Laakmann-McDowell?comment_id=9146415&comment_type=2
Anyway, OPs point is that e.g. `<=` is arguably just a digraph for `≤`.
Except that `≤` is not even legal, and then they argue that that is the
problem, because it requires people to keep using the digraph.
> I agree that UTF-16 and UCS-32 are essentially dead. I know that Windows
> runs on UTF-16, but I still recommend using UTF-8 and then convert only
> when reading to/from a Windows API.
>
> D was designed to be agnostic about UTF-8/16/32, as that was the sign of
> those times. But I asked Adam Wilson to abandon UTF-16/32 for the new
> Phobos, other than the adapter ranges.
>
> As for ≥ ≤ ≠, they certainly look nice. But I don't really want to look
> at a cheat card to remember how to type them in.
>
For me it is literally just
\>= (or \le)
\<= (or \ge)
\neq (I am used to this anyway, but could be reconfigured to allow \!=
as well easily).
I think the bigger issue with `≠` that it's clearly the negation of `=`
and not `==`. Arguably `==` is the "digraph" for the "Unicode variant"
`=`, but `=` is already parsed as assignment.
Therefore code would likely have to mix `≠` and `==`, or there would
need to be a way to overload `=` to mean equality comparison sometimes
and assignment other times. I think this would be somewhat annoying to
try and pull off in D.
More information about the Digitalmars-d
mailing list