Kotlin/Native as Go alternative?


#1

Hey community,

I’m a Golang developer, I used to be a Kotlin developer and I love it so much, however I don’t like the JVM, I don’t like how I need to get either extremely large self contained executables, or have the java runtime if i need to run my program.

So I moved to Go, and I like it there ! And I have my hopes up for Kotlin/Native so I can get back to my beloved language of choice. So does anyone know if Kotlin Native can interop or completely take over Go ?


#2

Java runtime in Jlink build takes about 10-15 Mb, so I do not know what you mean by “extremely large”. Also there is a SubstrateVM to solve this problem.

As for Go, not likely. Not because Go is so good, because it is simple. Simple to start and quick to deploy. You can use it with much less qualified (read cheap) programmers.


#3

ironically, many go developers are google employees. According to some surveys, Go developers have the highest salary and salary-to-experience ratio.


#4

I think the ratio is the most important ratio. I do not work in Go ecosystem so I could be mistaken, but basic maths shows that if you have the fixed salary for all developers, than you will have almost infinite average due to division by zero for inexperienced ones. I’ve recently written an article explaining why simplicity is more important for adoption than flexibility. I was talking about python, but I think it also makes sense for Go. Still, I’ve also explained that simplicity has it’s own limitations. And I think it also applies to Go. It is good in its niche, but will it develop outside of it?


#5

Actually it is possible to implement most of the GOPATH build system upon kotlin (except dependency names), so build chain isn’t an issue if you can preconfigure everything for the user (assuming you use kotlin native). Gradle is indeed an overcomplication if you don’t need all the fancy plugins.
As for the language itself, I think kotlin-stdlib isn’t that complicated.


#6

We are talking not about library complexity, but about language complexity. Generics really complicate things, especially projections. Of course one can write programs without them, but sooner or later you hit them. And then you need experience to understand what happens. Less features also mean less ways to do something wrong. Look at C++. A lot of features and you need to spend a year to understand it is better not to use most of them.


#7

Exactly. But aren’t we learning new things all the time? If there is, say, generics to solve a problem, it’s better than telling people “you need to use interface{} if you want to write a generic library”. I think golang is more like a set of programming guidelines for “you really shouldn’t use things not in this list unless you are willing to spend 10x the time to maintain this code and its propagated effect”. In my opinion, this isn’t something that a programming language is responsible for doing. (Maybe a lint plugin to highlight these bad things?) Otherwise it’s like disposing a chicken leg on your table for the fear of choking. It makes sense to use all efforts to prevent choking, including refraining from talking or even calling a doctor to rescue you beforehand, but it still doesn’t imply you should ban yourself from eating it for your whole life.
The point I’m trying to make is, who are you even trying to protect? Beginners of the language? Developers in your own team? A lint plugin will do the job either way.


#8

I’m not discussing the language complexity here, I know what Kotlin is as I spent more than a year writing Kotlin. I know what Golang is and I admit that Go is the simplest programming language I have ever seen, clean from inheritance and what-not.

What I want to know if Kotlin/Native would be able to interop with Go as it is now being interoperable with C, C++, Objective-C, and Swift …
Since Go already has really beautiful and fast tools and frameworks that would be great to just place in a Kotlin/Native project.


#9
  1. Kotlin native does not have interop with C++ and probably won’t.

  2. You can use C API in both, so you can just create external c wrapper for your go code and use it with K-N right now.

What tools and frameworks you are talking about? I do not know a lot about Go, but as far as I know, it is used mostly for server-side applications. In this case, ktor-native looks more interesting than using something from Go.


#10

lol, if you only build a hello world without dependencies, maybe
java/jvm is dead


#11

Yea, Assembly is really competitive for a typical “Hello world” application, however for this kind of software I really prefer sh script.


#12

It’s not and hard drive space is a really minor problem today when a standard hard drive has multiple terabytes.


#13

it’s not just about disk space, it’s about startup speed, memory/cpu footprint, compile speed
all of that matches with the needs of todays softwares where it’s not just about large companies anymore, startups plays a big role and they want fast and cheap development/deployment cycle

i may be totally wrong, but that’s what i use to see, people no longer think about java as first choice for their backend stuff anymore

(i’m young, maybe that’s not the case with seniors, but the workforce of tomorow will be the young developpers of today, so yeah i extrapolate a lot)


#14

once kotlin native will fix its unbelievable slow compile time and performance issue, i think it’ll be able to compete with go, but for now it’s way too early


#15

@scellow You are not wrong, but you are missing a whole picture.
It is not possible to elect now “the best language of 2020”, however I am pretty sure that there not will be “the best language of 2020”.

“startup speed” is important, or not? Often execution speed is important: a server can be slow to start but have to be fast to execute. You have to choose a use case.
“memory footprint” is important, or not? Under memory constraint you cannot choose any language with a garbage collector, you have to drop JVM, Go or Javascript; are these unpopular?
“cpu footprint” is important, really? A large parte of software runs in a Javascript interpreter using a single thread. It is a unusable software?
“compile speed” is a nice to have, but you are free to use an interpreted language.

This is not my experience, but I may totally wrong, too.


#16

Compile speed for kotlin is rather good. It is usually few seconds for complex project with multiple modules if you use gradle daemon. Of course, it depends on reference point. Python/JavaScript do not have compilation at all. Scala or C++ could be much slower. Compilation time begins to matter than it is larger than few minutes.


#17

for some applications, you want to be able to deploy and run as QUICK as possible, so JVM is not a solution

again, often you’d prefer your server to cost as low as possible

again, you want to lower cost of your server as much as possible without wasting ressources

native != slow compile, it shouldn’t be the case for kotlin native, we talk about being a go alternative, if you can’t be on same level as go, it’s a battle lost before it even starts…

on JVM kotlin compiles slower than java, it’s sensible, kotlin native on other hand compile time is a nightmare, TDD becomes really annoying, it hurts productivity

i believe in kotlin native, but as of today no it’s not an alternative to GO


#18

i disagree, compilation time begins to matter when it’s longer than 1 second, we only talk about parsing files c’mon, if it’s slow, then compiler architecture is built on bad and wrong bases, refactoring all that mess will take a long time, many languages died because of this


#19

🤦


#20

??

that’s the job of the compiler, parse source code and produce a binary

my go project with 100k lines of code takes less than 1 second to compile