Can someone explain why `Result` was added to the ...
# coroutines
z
Can someone explain why
Result
was added to the standard lib, when it’s effectively useless outside of Coroutines? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/ A standard
Result<T>
type that we could use as a return value would be incredible useful, and this seems to be a waste of a namespace?
z
Why is it useless outside of coroutines?
z
I just really want to use it as a return type
maybe that just means I don’t fully understand it
z
Oh, because of the error? The release notes for 1.3.70 said they lifted restrictions on it, I just assumed that’s what they meant. But yea it doesn’t look like they did.
Well, I could have sworn I saw that in the release notes somewhere… but now I can’t find it.
z
oh wow this is a big deal. We’re an internal company SDK so I don’t think we should be using experimental APIs like
inline class
yet though
(btw, I ❤️ the experimental stuff Kotlin does. Allows for great feedback and iteration. I couldn’t imagine coroutines without
CoroutineScope
)
z
And who knows when inline classes are going to stabilize. I don’t think I’ve seen anything about that for 1.4 😞
z
inline classes can’t be consumed from Java right though? So using
Result<T>
on a public API that may be called from Java would be a problem?
z
I think they can, but it boxes them so you don’t get the optimizations. I’m a bit rusty on the details there though.
👍 1