Hi, does someone develop kotlin/js at windows please? Friend of mine has a problem with compilation - compiler produces bad suffixes for overloaded non public companion methods, all are ended by _0. He even tried it at plain fresh instalation in virtual servers, got good result at linux but wrong again at win10.
a
altavir
03/18/2021, 4:38 PM
I am using win 10. No problems. I am not sure what suffixes you are talking about
j
Jaroslav
03/19/2021, 7:29 AM
Kotlin usually adds a random suffix to name of method to avoid collision between same names from different modules. Or to solve collision of overloaded methods. Example:
kotlin:
companion object{
protected fun foo(i: String){....}
protected fun foo(i: Int){....}
protected fun foo(i: Double){....}
}
in JS names will be foo_0, foo_1, foo_2
he experiences problem that all variants has suffix _0, if methods are declared in companion object and are protected. And only in win10.
a
altavir
03/21/2021, 11:56 AM
It is called name mangling and I do not think it is connected to windows 10. In general, when you are calling kotlin function from JS, it is not guaranteed to work. You should use JsName and/or JsExport annotations to control that.
j
Jaroslav
03/22/2021, 9:02 AM
In this case it is all kotlin translated to JS. Win10 is only difference we found;)