You are currently viewing How/why are inline properties useful?

How/why are inline properties useful?

Stuff I’ve read:

https://kotlinlang.org/docs/inline-functions.html#inline-properties

https://stackoverflow.com/questions/43292802/what-are-the-use-cases-of-kotlin-inline-properties

After reading the stackoverflow I still don’t understand why it’s useful? What is it that we couldn’t do before inline properties were added?

Also can someone explain this code to me:

inline val <reified T : PsiElement> T.nextSiblingOfSameType: T? get() = PsiTreeUtil.getNextSiblingOfType(this, T::class.java)

I think I’m confused with this syntax:

T.nextSiblingOfSameType: T?

At the call site how would this be used? I think maybe another example would also help.

submitted by /u/IllTryToReadComments
[link] [comments]