Sujet : Re: about some potentially interesting unicode operators
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 29. Aug 2024, 01:04:46
Autres entêtes
Organisation : None to speak of
Message-ID : <87a5gwb3dt.fsf@nosuchdomain.example.com>
References : 1 2 3 4
User-Agent : Gnus/5.13 (Gnus v5.13)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Wed, 28 Aug 2024 12:46:55 -0700, Keith Thompson wrote:
A problem with using non-ASCII Unicode characters as operator names is
that they can be difficult to type -- and the way you type them is
inconsistent across systems.
>
The best way is the Compose key available on *nix systems. This is the
closest to a mnemonic-based system that reduces the burden on your memory.
>
<https://wiki.wlug.org.nz/ComposeKey>
There is no "Compose" key on the keyboard I'm using to type this.
There is a key labeled "Alt Gr", but it doesn't appear to behave in
any consistent or useful way. (I'm using a Windows laptop; "Alt Gr"
doesn't appear to do anything useful even in Windows PowerShell.)
If there's an easy way to type non-ASCII characters like '·' that
works across different systems, including all the various terminal
emulators used on Windows and Linux (as well as MacOS, but I don't
happen to use it), I'd love to know about it. (I obtained that
'·' character by opening vim, entering the Ctrl-K . M digraph,
and copy-and-pasting into this window -- not something I'd be
willing to do every time I want to type an operator symbol.)
People who use non-English languages typically have keyboards with
accented letters and so forth.
There's nothing wrong with using identifiers as operator names.
C already does this with "sizeof" et al.
>
Except they add to your list of reserved words.
That's not much of a problem if they're designed into the language from
the beginning. (I'm not suggesting adding new keyword operator symbols
to C -- though C has been acquiring new keywords, including alignof
which is an operator and typeof which resembles one.)
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */