# Kotlin 1.3 has a Result\<T\> type if you opt into inline classes

**URL:** <https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068>\
**Category:** Language Design\
**Created:** [June 12, 2020, 7:41pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068 "2020-06-12T19:41:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lhmzhou](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@lhmzhou](https://discuss.kotlinlang.org/u/lhmzhou)\
**Post date:** [June 12, 2020, 7:41pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/1 "2020-06-12T19:41:31Z")

</div>

Looks like maybe you don’t have to opt into inline classes to use `Result`, even though `Result` itself is an inline class? What is the motivation behind why `Result` was not parametrized over the error type?

---

<div class="post-metadata">

**Author:** ![fvasco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fvasco/32/1961_2.png) [@fvasco](https://discuss.kotlinlang.org/u/fvasco)\
**Post date:** [June 13, 2020, 11:38am UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/2 "2020-06-13T11:38:03Z")

</div>

Because `Result` is guaranteed to be stable.

---

<div class="post-metadata">

**Author:** ![lhmzhou](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@lhmzhou](https://discuss.kotlinlang.org/u/lhmzhou)\
**Post date:** [June 13, 2020, 12:09pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/3 "2020-06-13T12:09:23Z")

</div>

Can `Result` be used as a return type in a function? The following code snippet will yield an error:

> fun foo(): Result { // error ‘kotlin.Result’ cannot be used as a return type  
> return Result.success(“foo”)  
> }

---

<div class="post-metadata">

**Author:** ![fvasco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fvasco/32/1961_2.png) [@fvasco](https://discuss.kotlinlang.org/u/fvasco)\
**Post date:** [June 13, 2020, 12:29pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/4 "2020-06-13T12:29:03Z")

</div>

You should use String instead.

---

<div class="post-metadata">

**Author:** ![lhmzhou](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@lhmzhou](https://discuss.kotlinlang.org/u/lhmzhou)\
**Post date:** [June 13, 2020, 12:45pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/5 "2020-06-13T12:45:16Z")

</div>

“guaranteed to be stable” \<---- Can you explain?

---

<div class="post-metadata">

**Author:** ![fvasco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fvasco/32/1961_2.png) [@fvasco](https://discuss.kotlinlang.org/u/fvasco)\
**Post date:** [June 13, 2020, 2:13pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/6 "2020-06-13T14:13:11Z")

</div>

[https://kotlinlang.org/docs/reference/evolution/components-stability.html](https://kotlinlang.org/docs/reference/evolution/components-stability.html)

---

<div class="post-metadata">

**Author:** ![lhmzhou](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@lhmzhou](https://discuss.kotlinlang.org/u/lhmzhou)\
**Post date:** [June 14, 2020, 12:55pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-3-has-a-result-t-type-if-you-opt-into-inline-classes/18068/7 "2020-06-14T12:55:29Z")

</div>

Perfect, thanks.
