Earlier quoted context omitted.
short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work: let x : Something = condition ? foo() : bar() but yeah, it would be nice to defer initialization of an immutable.
often times you want to do more stuff in either case so ? does not always work. The if-else approach is more general.
let x: Something = {
if condition {
someSideEffect()
return foo()
} else {
anotherSideEffect()
return bar()
}
}()
But it's kind of ugly.