Open Woccz opened 3 years ago
A problem here is the lack of type-information. Replacing and/or with */+ is only safe, when you are sure that the user is only interested in the truthvalue of the computation.
You are right, if the expression is used DIRECTLY as condition for an if, that would be safe to assume. But even in cases like
if (a or b)==(c or d) then ....
this would fail in unexpected ways.
I guess if I ever find a way to implement a proper type-system, optimizations like this could become relatively simple.
Waiting for #48
Sometimes logical expressions can be replaced by arithmatic expressions, due to YOLOL using number type variables for booleans.
Example:
I'm not sure of all the places these expressions can be substituted, for example,
x+= a or b
can result in a different output fromx+= a+b
. Perhaps it is best to just replace statements used for logical evaluation, i.e.if x then ...
Thank you.