Open mkruselj opened 11 months ago
This needs to respect short-circuit evaluation. The rules are
For expression if A and B
proxies for A
if A
proxies for B
if B
code
For expression if A or B
proxies for A
if A
code
else
proxies for B
if B
code
end if
Of course this would have to be written properly as part of an expression tree to build how far the if-statements expand when expressions are more complex. I would not add this feature if you can not make it respect short-circuit evaluation; it would invalidate basic rules of programming.
Let's say we have a function like:
We currently cannot inline this function in cases like these (or at all, really - cannot even assign such a function to a variable directly):
What would need to happen is:
There would have to be a proxy variable for every expression that is bool'd together. Probably makes sense to use an array instead.
becomes: