Is there a YT ticket for anything like this language enhancement? someOptBoolean? <=> someOptBoolean == true
thus if (someOptBoolean?) <=> if (someOptBoolean == true)
then if (!someOptBoolean?) <=> if (someOptBoolean != true), even though it looks weird, but meaning is clear, I think.
Or just auto-convert opt-boolean to boolean with meaning (opt-boolean == true), if boolean is required.
worked out the ifelse.
Is probably overkill, but for fun:
WARNING: In the ReturningIfContinuation, the generic is determained using the top level function.
In this way, there is no unsafe cast.
The drawback is that when you return multiple types, the compiler may infer a different type.
val t = retIfP(true){
""
} else {
null //expected type of String
}