Unicode operators and precedence?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Nov 2 10:04:19 UTC 2020


On Monday, 2 November 2020 at 08:30:37 UTC, Dominikus Dittes 
Scherkl wrote:
> 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.

I understand what you are saying, but set operators for this 
would be unusual in computing I think. Also, Xor, Nand and Nor 
should work on bitvectors.. so for consistency...

> Also all of them are new, so precedence can be assigned to your 
> wishes without braking existing code.

But I think bitoperators should have higher precedence than set 
operators?

Lots of trade offs... for sure.

> How could they, as the language doesn't offer them as operators?
> I think in HW design at least Nand is heavily used...

Yes, might be useful for implementing algorithms from papers. 
Crypto etc. Easier to visually check for typos if the code in the 
IDE looks more like the code in the paper.

> 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).

True, except "~" is used for concatenation that is completely 
unrelated. I think it would be nice to get a quick interpretation 
of code by humans (at least conceptually) by not using the same 
symbols for multiple meanings.

Hard to tell in advance what feels right, worth experimenting 
with.



More information about the Digitalmars-d mailing list