if this is the logical or, the combined operator should be "or=" or "or ="; if this is the numerical operation it should be "|="....
so
var = var or function1()
could become:
var or = function1()
This should apply consistently to all binary operators.
And does not require any change to the lexical analyzer, inserting a whitespace or newline in "or =" would still be valid, parsed as two tokens.
* With the logical operation, the right-handside _expression_ (including function calls) may not be evaluated if the left-side operand (the assignable variable) is boolean-evaluated to be **true** (like for the binary operator), and so no reassignment would occur to the variable,
otherwise it would evaluate the left-hand side _expression_ and assign its result to the variable (without coalescing it to a boolean).
* As well with "and=", the right-hand-side _expression_ may not be evaluated if the left-side operand is
boolean-
evaluated to be **false**, and so no reassignment would occur to the variable ;
otherwise it would evaluate the left-hand side _expression_ and assign its result to the variable (without coalescing it to a boolean).
* In both cases, the boolean-evaluation of the left-hand side varaible would consist in getting its value: if it's false or nil (or NaN ?), it evaluates as false, otherwise any other value (including integer 0 or float 0.0) would evaluate to true.
The behavior in case of NaN is debatable but it should be the same as in the binary _expression_ using "and", "or", "not" operators. If
* "<NaN> or <anyvalue>" should have non-boolean value "<NaN>", and
* "<NaN> and <anyvalue>" should both have non-boolean value "<NaN>",
then this means that the "or=" and "and=" bindop-assignments must implement the shortcut to not evaluate the right-handside if the variable is NaN, in order to preserve the NaN value in the lef-handside assignable variable.
So the rules should become precisely:
* With "<var> or= <_expression_>", the right-handside _expression_ may not be evaluated if the left-side operand (the assignable variable) is boolean-evaluated to be **true** or **NaN**, and so no reassignment would occur to the variable,
otherwise it would evaluate the left-hand side _expression_ and assign its result to the variable (without coalescing it to a boolean).
* With "<var> and= <_expression_>", the right-hand-side _expression_ may not be evaluated if the left-side operand is
boolean-
evaluated to be **false** or **NaN**, and so no reassignment would occur to the variable ;
otherwise it would evaluate the left-hand side _expression_ and assign its result to the variable (without coalescing it to a boolean).