-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: for Kotlin, offer to replace "interface" with "fun interface" when possible #11
Comments
Yes, but how this is useful? |
Aren't those advantages enough? |
Here, a talk about it: |
Still, why prefer fun interface over functional type? For example, the former cannot be inlined. |
Can you please provide an example (code snippet) of when it isn't a nice thing to have? |
I personally prefer it this way. I think on Java it's automatic, no? |
Well, there's no technical difference between fun interfaces and grumpy ones. What I mean is interface A { fun run() }
fun interface B { fun run() }
typealias C = () -> Unit
inline fun a(/*actually noinline*/ a: A)
inline fun a(/*actually noinline*/ b: B)
inline fun a(c: C) // truly inline NB: this is just an observation from the IDE behavior. I haven't found any official information about this. |
By "noinline", you mean it's not inlined, right? |
Right, and Kotlin has an according soft keyword: |
@Miha-x64 Oh I never used it. Sorry for that. Kotlin has some special keywords that I never used, and I don't think I even saw someone using... |
I think it's enough to just check if the number of functions in the interface is just one, not sure.
The text was updated successfully, but these errors were encountered: