How bad is it if x < y doesn't return a Bool?

Then that’s probably the solution you’ll have to go for. It’s just important to make sure that everyone is aware that this kind of approach explicitly goes outside of the semantics the original user code was written under. It’s not a general solution for arbitrary code.

2 Likes

If the point of this is to work for user code, how do you hope to handle actually-branching code like x < y ? x : y, if/else, or non-independent for/while? Is actual control flow explicitly unsupported? What about “boolean arithmetic” like x *= (x > 0)? None of those seem compatible with non-Bool comparison.

I imagine ifelse(x < y, x, y) is merely a MWE, but it does suggest that you need to overload min/max among your other functions.

1 Like

Yes, that kind of control flow would try to cast x < y as a Bool and thus error. In such cases however, ifelse will work.

This however will be supported, because we settled on a design where the return of x < y is also a Number.