Why 2 languages, Swift and Kotlin, not 1?

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.

8 Likes

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.

1 Like

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

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.

1 Like

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.

1 Like

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.

I'd just like to point out that Google has not acquired anyone from the Kotlin team. The team continues to work at JetBrains and Kotlin continues to be developed by JetBrains as well as external contributors, including folks from Google.