# KMM Oddity #1: Interface methods with underscores

DevFeed: [KMM Oddity #1: Interface methods with underscores](<https://devfeed.tech/articles/kmm-oddity-1-interface-methods-with-underscores-24737.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/kmm-oddity-1-interface-methods-with-underscores-21523b8ed797?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-09-20T04:23:21Z

Content type: tutorial

Language: en

Sources: [xorum.io - Medium](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Objective-C](<https://devfeed.tech/topics/objective-c.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [kotlin-native](<https://devfeed.tech/topics/kotlin-native.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [ios](<https://devfeed.tech/tags/ios.md>), [kmm](<https://devfeed.tech/tags/kmm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [objective-c](<https://devfeed.tech/tags/objective-c.md>)

## AI overview

This article examines a Kotlin Multiplatform Mobile interoperability oddity in iOS. It explains how the Kotlin/Native compiler can expose an interface method with an underscore suffix, such as eat(food_:), when similarly named methods from different interfaces may clash in Objective-C.

## Source excerpt

Kotlin Multiplatform attracts more and more developers every day. Especially after the technology transitioned to the Alpha stage. On its way to Beta, KMP removes all major hassles (Memory Model, for example). Nonetheless, you can still find "a few" more minor bugs and oddities reported in Kotlin's YouTrack. They aren't blockers for using KMP in your production application but may cost you several hours of wondering what and why is happening in your mobile application (mainly on iOS). I faced many such issues myself since I've started using Kotlin Multiplatform Mobile two years ago. In this series of articles, I'll share my favorite oddities of KMM with explanations and workarounds (if possible). Kotlin/Native Obj-C interop Shared KMM modules are written in Kotlin, hence can be used in Android native applications as it is. On iOS, it's more complicated because of Objective-C and Swift, which can't directly use Kotlin code. Kotlin/Native plugin compiles shared KMM modules to iOS frameworks, which contain binary and Obj-C header. You can find them in the build folder of the shared module, under bin/iOS/. Many concepts of Kotlin don't exist in Obj-C, so specific shortcuts and workarounds need to be applied to make it work. It is where some oddities start appearing. Interface methods naming clash Let's say we have two types of pets -- Dog and Cat, which we need to feed with some specific Food. In Kotlin, we could represent that with two interfaces, each having an internal (embedded) Food class. https://medium.com/media/b868e0383cdc20566aef171daa863a87/href It works perfectly well in Android, but on iOS Dog will have eat(food_:) method instead of eat(food:). Where does that underscore suffix come from? And why do we need it? It looks like Kotlin/Native compiler thinks there will be a clash between eat(food:) methods of Dog and Cat interfaces, so it's safer to make them different by implicitly adding an underscore to the 2nd one. I'm not sure it will become a problem and i