Skip to content

Non industry standard operator mappings #23

@shishioko

Description

@shishioko

What?
The suggestion is to use an alternate mapping of arithmetic, logic, and other operators.
For example, instead of the industry standard (shown with a "=" for readability, if applicable) |=, &=, ^=, != for OR, AND, XOR,
an alternate mapping of +=, *=, /=, ~= could be used.
!= could also be used for integers and booleans instead, instead of ~= at all, although NOT could also just be fully made obsolete for booleans, by just using XOR without a left operand.

There is no reason, besides learnability by similarity, to keep the obsolete operators, first seen in ancient languages like C, where booleans and integers were not properly seperated yet.

Why?
This could free these operators for alternate uses, such as ^= for squaring numbers, which is not as complex of an operation as it used to be on old systems, and others not thought of yet.

Concretely, if there are no issues with this, I'd suggest the following mappings (written with a "=" for readability, again, if applicable):

(usual) = for Writing.

(changed) ? ! instead of == != for Equality Comparisons (It's very unusual, but more distinct and uses just a single symbol).
(changed) <= >= for SmallerThan, GreaterThan

(changed) **= //= for ShiftLeft, ShiftRight
(changed) --= ++= !!= ??= for OR, AND, XOR (inversion with 0 left operator), XNOR

(unchanged) += -= *= /= \= for Addition, Subtraction, Multiplication, Division, Modulo

But, it is to be noted, that single use operators would not be feasible with this mapping due to, unclear ordering and operator grouping (for ! and !!=, ...) and ++, -- already being mapped.
This is a drawback, but, at least in my opinion, not a significant one, as single use operators can just as well, and even more clearly, be expressed with just a single 0 on the other side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions