This PR is not meant to be an implementation of the choose function itself, and this does not remove the target functions that will be deprecated soon.
Basically, the way if?, else, case, when? works is very problematic. Since they depends on each other, and should be independent. Other problem is the fact that else and when? violates the way the stack really works, so this is a valid code:
false
else -> print "Whut??"
; Whut??
And as we may know, this can lead to hidden bugs in a lot of code. That is the reason why me and @drkameleon were avoiding for a long time to use those functions.
So, this is time to change. But first things, first.
We need tests first, to check if the behavior is what we desire, then we need to implement that function and then we need to optimize it.
Worth to say, that choose will replace all of them into once.
Type of change
[ ] Code cleanup
[x] Unit tests (added or updated unit-tests)
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] Enhancement (implementation update, or general performance enhancements)
[ ] New feature (non-breaking change which adds functionality)
[x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Description
This PR is not meant to be an implementation of the
choose
function itself, and this does not remove the target functions that will be deprecated soon.Basically, the way
if?
,else
,case
,when?
works is very problematic. Since they depends on each other, and should be independent. Other problem is the fact thatelse
andwhen?
violates the way the stack really works, so this is a valid code:And as we may know, this can lead to hidden bugs in a lot of code. That is the reason why me and @drkameleon were avoiding for a long time to use those functions.
So, this is time to change. But first things, first. We need tests first, to check if the behavior is what we desire, then we need to implement that function and then we need to optimize it.
Worth to say, that
choose
will replace all of them into once.Type of change