I feel like this is going to be to kotlin's disadvantage going forwards as languages features are slowly added into Java, they will be more 'complete'.
Java can never be Kotlin without breaking a lot of backwards compatibility. That is the "edge" a newer JVM language like Kotlin enjoys.
Since Java's history is very focused on not breaking things (and folks got really grumpy on the few occasions something has been broken), Java cannot ever match the feature pace of languages like C# either.
But the folks writing Java code (most of you here on HN by all metrics), mostly don't care. They enjoy backwards compatibility and stability far more than new features. The overwhelming majority of newly written Java code is targeting Java8 still - which doesn't use any of these new features anyway.
Backwards compatibility is also why things like lambda's and streams are the way they are in Java (and most FP folks would sneer at), and things like Records took years to release (still technically in the Preview stage).
The advantage Kotlin has, and the reason it's growing in popularity in backend development is you get all the FP tasty features you want right now, but maintain near drop-in compatibility with existing Java libraries and frameworks. This was the most brilliant move by the Kotlin designers in my opinion...
> The overwhelming majority of newly written Java code is targeting Java8 still - which doesn't use any of these new features anyway.
Java 8 users are now a minority. Some libraries still target it (although Spring 6 targets 17 as the baseline), but most Java code is in applications.
> Java can never be Kotlin
Java doesn't want to be Kotlin because it aims at a much wider audience. Back in the nineties James Gosling laid out a strategy of an innovative runtime wrapped in a conservative language that only adds the most beneficial features, and only after they've been successfully tried in other languages, and this has worked very well.
Also, the Java language has the advantage of controlling the runtime, which allows us to add a smaller number of features, which are more powerful (e.g. compare records with data classes, or virtual threads with syntactic coroutines), while Kotlin can neither change the runtime nor have a significant impact on the ecosystem, and so is more limited in what it can achieve. Moreover, Kotlin's features are increasingly mismatches with the evolution of the platform.
Nevertheless, we are happy that the platform offers more feature rich languages to the minority of developers that do prefer them (or languages with radically different approaches, such as Clojure), so the platform can cater to programmers with different language preferences.
> Java cannot ever match the feature pace of languages like C# either.
That's by deliberate choice. They are going down the route of having the last mover advantage. Lots of people have complained about C#'s kitchen sink type of approach for example. And the more features you have, the more chance that they won't fit together neatly and cleanly.
A couple of examples that come to mind, Java's pattern matching/destructoring and upcoming string templates (JEP 430) are much more fully fledged compared to their Kotlin counterparts.
It also has the advantage of being the platform language. Now that we have virtual threads on the JVM, async/await immediately becomes irrelevant. However, Kotlin now has to maintain coroutines even though the platform offers a better way of doing things.
> As a C# advocate I have to say, that the C# design team is doing an excellent job. The amount of syntax I see literally 1:1 taken over by dozen other languages is really impressive and evidence for that.
That would be the case for pretty much any language that has lots of features (provided that most of those features aren't completely terrible). A good design (at least for a mainstream language) also strives to minimise the number of features, not adding everything you can but only adding things you absolutely need. In the case of C#, many of its features are not widely adopted, and Java in particular will never adopt them.
Java's philosophy has always been to wrap an innovative runtime in a conservative language that only adds features late, after they've proven their worth elsewhere and when most mainstream programmers are ready for them, with the realisation that every added feature adds a cost to learning the language. That strategy has worked very well for Java, but .NET has a different strategy (a more adventurous language built on top of a less adventurous runtime). We'd rather spend two years thinking about how to avoid adding a new language feature than spend six months adding it. This "last-mover" strategy has helped us maintain our philosophy and keep the number of features small compared to C#. We strive to only add features that have a big bang-for-the buck and that, preferably, solve many problems at once, rather than add many features, each addressing a relatively small problem. For example, virtual threads have allowed us to avoid adopting async/await; records are allowing us to avoid adopting properties, and will likely help us avoid adding named and default parameters as a separate feature (which, in languages like C#, Swift, and Kotlin breaks binary compatibility/separate compilation).
I posted that in parallel. C# tries to be both, a system and application language. Java does not try that. Therefore, they can skip all the memory related topics quite quickly. And that wades out like 80% of the average joe unused features.
I would rather that they would give more support to F#, and improving the story on the Common Language Runtime between all existing MS languages, instead of rebooting the whole experience into C# Language Runtime.
F# goes right up with D as "most under-rated/under-recognized language of all time"
A lot of its features for functional programming got swallowed up in later C# versions, and it's the Red-Headed Stepchild of the CLR (let's pretend VB.NET doesn't exist).
MS allows it to exist but it's a second-class citizen on the CLR, and, I think, always will be =(
their numbers are simple .... C# has millions of developers, VB.NET 100ks and F# 10ks. They put their focus where their users are. They presented a slide deck once about that.
And F# was created as a research project and is a lot more community driven than C#. So if Microsoft starts putting more people onto that, I think a part of that community will also scream that they should stay out.
> Java cannot ever match the feature pace of languages like C# either.
Thank God. Don’t get me wrong, C# is a cool language but languages suffocate under so many features, most devs will simply never ever learn most of them. And some of these features while invaluable in certain rare cases, I would rather prefer a better, more fundamental feature that takes more time and single-handedly solves for many situations.
Unfortunately modern languages really like to throw in everything they have seen from other languages ever, and even with very smart language designers these features will inevitably tangle (khm, swift).
C# tries to be a system language (for writing servers, runtimes, and even operating systems) AND an application language (for writing your favourite apps). So you have now a huge feature set which is focused on efficient memory handling and then you have another feature set on writing nicely applications (think pattern matching etc).
It's actually crazy what you can do with C# as far as systems programming nowadays.
I recently wrote a database buffer pool with it, allocating raw aligned memory and directly casting bytes from DB files into in-memory struct pointers.
It's very nearly a systems language in terms of capabilities.
While WinDev keeps ignoring such improvements and rather doubles down on the C++ / COM combo, including forcing everyone else to deal with writing .NET bindings to those APIs.
CsWinRT and win32metadata are still quite far from a great usability experience.
I don't think it can be Kotlin, but I don't think it needs to put a serious dent in Kotlin adoption, as it just needs to stop driving people away so hard and then the friction to do something different will keep people in Java if Kotlin is say, only 30% nicer. See for example coffeescript getting limited by ES6.
IMO Kotlin is barely nicer than Java currently. Java has for the most part implemented better or equivalent versions of a lot of Kotlin's features (e.g. virtual threads, pattern matching, sealed classes).
The last things missing are properties (which should be coming with reconstructors), and nullable types. For me, nullable types are not worth the switch.
All that being said, I don't think the languages are mutually exclusive. As a JVM developer you retain all your knowledge of the JVM and it's standard library. Lastly, a language doesn't have to be the dominate language on a platform to be usable and employable (just look at Scala).
Adding features doesn’t mean breaking backwards compatibility, I can only think of modules since Java 8 that can maybe be.
What Kotlin features are possible because of that freedom ?
Genetics can be an example I can’t say it’s impossible for Java to add in out refied keywords
I don’t know, in theory replacing types with ‘var’ would work just as well for Java, the advantage (or more like elegance) of ident: type syntax comes from a parser perspective.
Kotlin has made its pack with the Chocolate Factory, as such they need to now live with the consequences of being a language whose main purpose is to write phone apps where compatibility with Java isn't taken seriously.
Since Java's history is very focused on not breaking things (and folks got really grumpy on the few occasions something has been broken), Java cannot ever match the feature pace of languages like C# either.
But the folks writing Java code (most of you here on HN by all metrics), mostly don't care. They enjoy backwards compatibility and stability far more than new features. The overwhelming majority of newly written Java code is targeting Java8 still - which doesn't use any of these new features anyway.
Backwards compatibility is also why things like lambda's and streams are the way they are in Java (and most FP folks would sneer at), and things like Records took years to release (still technically in the Preview stage).
The advantage Kotlin has, and the reason it's growing in popularity in backend development is you get all the FP tasty features you want right now, but maintain near drop-in compatibility with existing Java libraries and frameworks. This was the most brilliant move by the Kotlin designers in my opinion...