Unicode operators and precedence?
Dominikus Dittes Scherkl
dominikus at scherkl.de
Mon Nov 2 08:30:37 UTC 2020
On Sunday, 1 November 2020 at 21:13:07 UTC, Ola Fosheim Grøstad
wrote:
> I am adding keywords "or", "and" "not" for boolean logic.
Bah. Why?
>> No, they are clearly logic operators and should NOT have set
>> semantics.
>
> Well, it depends on what kind of software one writes. You could
> also view an unsigned int as a vector of bools rather than a
> set.
Yes, but a vector is still a kind of set (only has much richer
additional structure), so use set operators on it, not boolean
logic. Boolean is for only one bit at a time.
I still think replacing & with ∩ and | with ∪ is the best way to
go, so ∧ can be used instead of && and ∨ instead of ||. No need
for words and all standard so everybody should know what they
mean.
Also all of them are new, so precedence can be assigned to your
wishes without braking existing code.
>
>> Hmm. Maybe you are right - Xor, Nand and Nor are more useful
>> as additional set operators.
>
> Nand and nor might be nice to have, not sure if people use them
> much, but.
How could they, as the language doesn't offer them as operators?
I think in HW design at least Nand is heavily used...
>
>> Ah, i missed one:
>> ~ --> ∁ (complement)
>
> I looked at that one, but it is virtually indistinguishable
> from a regular C.
Ok, at least ~ is there and does not have a bad precedence so no
urgent need to replace it by something different, although it is
non-standard (at least for a mathematician).
More information about the Digitalmars-d
mailing list