Unicode operators and precedence?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun Nov 1 20:22:57 UTC 2020
On Sunday, 1 November 2020 at 20:09:17 UTC, Dominikus Dittes
Scherkl wrote:
> On Sunday, 1 November 2020 at 19:47:33 UTC, Dominikus Dittes
> Scherkl wrote:
> And with Unicode we could of course replace all the clunky
> two-char operators or misused characters with standard
> dedicated single chars:
>
> != --> ≠
> <= --> ≤
> >= --> ≥
Yes, I have implemented those.
> == --> = (compare)
Yes, I have that (not on github), but with a different filename
extensions so that one can compile D-files and experimental D
syntax in the same build.
> = --> ≔ (assign)
Maybe a bit difficult to see?
I have implemented a unicode left arrow for assignment.
Actually these are in, you can use both syntaxes in the same .d
file:
NEW: symbol‹…›
OLD: symbol!(…)
NEW: x ⟵ expr
OLD: x = expr
NEW: symbol ≡ type
OLD: alias symbol = type
(I think this should be used for manifest constants too, but not
sure how to implement it yet.)
NEW: x ≤ y
OLD: x <= y
NEW: x ≥ y
OLD: x >= y
NEW: x ≠ y
OLD: x != y
> ! --> ¬ (logic not)
> && --> ∨ (logic and)
> || --> ∧ (logic or)
> ^ --> ⊻ (xor - and add the missing ⊼ (nand) and ⊽ (nor))
I was thinking to use those for bitwise operators in order to
overcome the precedence mess that currently exists. So they would
have lower precedence than equality. Also xor makes more sense
bitwise.
I have some more ideas here (may change, and I don't know when I
have time to start, more sure about the ones at the top than at
the bottom.):
https://github.com/OlaFosheimGrostad/dex/blob/master/EXTENSIONS.md
More information about the Digitalmars-d
mailing list