Is there any way to use private functions on inlin...
# announcements
p
Is there any way to use private functions on inlined functions? I know it does not make sense for the compiler, could be implemented any special visibility modifier for inline functions?
d
You can use
internal
in combination with
@PublishedApi
.
p
Jimmy can call
nukeWorld()
anytime 😰
d
Sorry... what?
p
it's a joke
d
Yes, I get that. But I don't get the context 😄
s
lol if I had to guess they mean that someone might be able to access methods that really ought to be private just so as long as they’re calling it from Kotlin
but I mean ultimately this confers a breach in encapsulation, whether you do it via annotation or if the compiler allows you to call private methods in an inlined function
d
It would not even work once compiled, since the function is still private, so it cannot actually be called from the callsite where the function is inlined to.
p
it's ok to make the check on compile time
d
Question is: Why does the function have to be inline?
p
because it has lambdas and are called very often
d
Okay. Then
internal
+
@PublishedApi
is the best you can do.
p
thanks 😄