Pre-RFC: Overload Short Curcuits

So there have been a bunch of proposed desugarings here, but there doesn’t seem to be consensus on what the semantics of the operation should even be.

As such, I recommend that people start by posting examples of what they would expect an overridden || to actually do.

I’ll start with mine from here:

Some(4) || 2 ==> 4
Some(4) || Some(7) || 2 ==> 4
None || None || None || 2 ==> 2
∀x, None || x ==> x
Some(1) || panic!() ==> 1
Some("hello") || "" ==> "hello"
None || Some("world") ==> Some("world")

Some(2) || Some(3) // ERROR: type mismatch i32 vs Option<i32>
Some(2) || "hello" // ERROR: type mismatch i32 vs Option<&str>
4 || "hello" // ERROR: || cannot be applied to i32
"hello" || None // ERROR: || cannot be applied to &str

I’d also be interested in hearing what other types with which you’d expect to use ||. For example, what types were you thinking would be Into<bool>, @diwic, to use your desugar? Right now there are none.