Why 2 languages, Swift and Kotlin, not 1?

(Frank) #21

I don't think 2 languages are needed. Swift already rules iOS and (in my subjective opinion) Android (www.scade.io).


As someone who uses both languages almost every day, they're not as similar as it might appear at first glance.

Though they both have modern, cleaner syntax than their predecessors, they also are designed with very different requirements for integration. Regardless of those constraints, they solve similar problems in much different ways.

e.g. the fundamental rule in kotlin of everything being an expression, and the prevalence of Protocols in Swift.

(Daniel Berger) #23

Good point. Also keep in mind that the core libraries and UI behave differently. Far more would be involved that just making either language universal. The underlying libraries behave differently.


I just want to say that kotlin guys are also interested in protocols.

(Josh Adams) #25

There can be no one language because different priorities exist. One example is ARC versus garbage collection. ARC imposes a cognitive burden. A developer using an ARC language must take affirmative steps to avoid retain cycles. The maintainers of Objective-C and creators of Swift decided that the burden is worth it because of the benefits of deterministic performance and lower RAM usage. FWIW, I agree with this decision because the memory-graph debugger makes finding retain cycles easy.


FWIW, in this case the type of memory management is platform dependent, not language dependent. Kotlin Native uses a form of ARC.

Kotlin->Java-ByteCode uses GC because that's pretty much the only option. Swift would also have to use GC if someone went through the trouble of compiling it into Java Byte-Code.

(Nobody1707) #27

They also have a cycle collector though, so it still has a full GC. Although, according to the paper they based it on, it's a very efficient one.