3 ms·
Kotlin on the JVM is a nice improvement over Java, still statically typed, the compiler infers the type for obj. var obj = MyObject() ... obj.foo() So y
by campers 11y ago
Kotlin on the JVM is a nice improvement over Java, still statically typed, the compiler infers the type for obj.
var obj = MyObject()
...
obj.foo()
So you could change the obj instantiation to a different type and as long as the new type has foo() too then you're good to go.
Also you can have your typed properties stored in a map, which you could also add other values to dynamically at runtime.
from https://kotlinlang.org/docs/reference/delegated-properties.html https://kotlinlang.org/docs/reference/delegated-properties.h...
class MutableUser(val map: MutableMap<String, Any?>) {
var name: String by map
var age: Int by map
}
I haven't used Scala but its (Duck)Structual Typing seems like it would get closer again to a dynamic typing feel with static types. Java is pretty verbose and limited in ways, and many devs having backgrounds in EJBs and Struts doesn't help. It would be interesting to see the same side-by-side project comparison in those links with a team using Scala well. Anyway thats all coming from my bias of having done 12 years of Java and 1 year of full Javascript with Angular.