Is there any language where this is implemented, or is the effort too great for the gains?
Is there any language where this is implemented, or is the effort too great for the gains?
Then it also would need to make sure that those parameters can't change between different calls within the same function.
This wouldn't be feasible in the example above, since that function explicitly depends on outside variables. If you were to supply both `health` and `alive` as arguments, you could pretty much write the check yourself from the beginning.
Of course, there are many bigger checks that could benefit from this, but still, you (or the compiler) have to make sure that all functions are pure, that no arguments can change etc etc. I imagine that this could make compile times quite slow (and also complicated to write the compiler itself).