janvladimirmostert
02/19/2019, 5:45 AMgildor
02/19/2019, 5:59 AMgildor
02/19/2019, 6:00 AMjanvladimirmostert
02/19/2019, 6:07 AMgildor
02/19/2019, 6:08 AMgildor
02/19/2019, 6:10 AMjanvladimirmostert
02/19/2019, 6:13 AMString doSomething(Integer param1, String param2)
Kotlin:
doSomething(12, "test")
or
doSomething(param1 = 12, param2 = "test")
This way, existing Kotlin code interopting with Java still works
You could make all the named parameters required when interopting with Java, that way, there are no null pointer surprises, unless you explicityly send in a null
doSomething(param1 = null, param2 = "test")
diesieben07
02/19/2019, 7:55 AMgildor
02/19/2019, 7:57 AMgildor
02/19/2019, 7:57 AMSvyatoslav Kuzmich [JB]
02/21/2019, 5:00 PMOr would this be an issue when interopting with JavaScript?I don’t think this would be an issue. JavaScript and Java interop are separate things. By the way, calls to JavaScript functions already allow named arguments because Kotlin/JS requires explicit Kotlin declarations for external functions.