9 ms·
> I feel kotlin is a bit undervalue. It is a great modern language which can replace java completely. It doesn't offer a compelling advantage. "Slightly cleane
by lmm 10y ago
> I feel kotlin is a bit undervalue. It is a great modern language which can replace java completely.
It doesn't offer a compelling advantage. "Slightly cleaned-up Java with a bit of syntax sugar" is not enough to justify having to make all your tooling (IDEs, profilers, monitoring, code coverage ...) support a new language. And if you are going to make all that effort, why would you not pick a language that offers some genuine killer features in return, like Scala or Ceylon? And it's got a lot of special cases, a lot of stuff in the language that should just be libraries, that I think will make it hard to maintain in the long run (the "CoffeeScript of Java" line is probably fair). If anything it seems overhyped to me.
- marc_omorain 10y ago> "Slightly cleaned-up Java with a bit of syntax sugar" This is not an accurate description of Kotlin. Kotlin has many features that make it better than Java. Most importantly, it is null-safe. In addition to that it makes it simple to enforce data-immutability, which is very difficult in Java. https://kotlinlang.org/docs/reference/comparison-to-java.html https://kotlinlang.org/docs/reference/comparison-to-java.htm...
- lmm 10y ago> Kotlin has many features that make it better than Java. Most importantly, it is null-safe. In addition to that it makes it simple to enforce data-immutability, which is very difficult in Java. Kotlin does have nullability handling yes, but it's a very limited special-case feature - it's a language-level builtin rather than something you can use in your own libraries. E.g. if you want to have an error message in the failure case rather than just null (i.e. some kind of Result type), you can't reuse any of the null-safety functionality (whereas in Scala or Ceylon you can write the same methods to work with either optional/nullable or result-like types). Data immutability isn't at all difficult in Java. It's tedious (sprinkling "final" everywhere), but not hard.
- hota_mazi 10y ago> it's a language-level builtin rather than something you can use in your own libraries The only people who still think that a library approach is superior to a compiler approach are Scala users. I'll clarify this for you: if it's a library construct, it can be ignored. And as a matter of fact, there is nothing in Scala forcing you to use `Option`. You can completely ignore it and enjoy your time diagnosing NullPointerExceptions everywhere. When a feature is enforced by the compiler, such as Kotlin and Ceylon, you don't get any easy way out: you have to think about null cases or you will not be able to compile your code. Period.
- lmm 10y agoYou're conflating two different issues. Yes, Scala allows null and yes, this is unfortunate, though it raises the question of whether there's any better way to do Java interop (you can either assume all Java calls are non-null unless checked, assume all Java calls are nullable and force checking, or trust annotations; all these approaches suck in their own way). It can be mitigated with WartRemover. But the right way to represent absence - whether you call it null or option or something else - is clearly with a normal type that follows the normal rules of the language, not a special language-builtin type with special language-builtin rules. Some light syntactic sugar for commonly-used types makes sense (like Ceylon's "?"), but what it desugars to should always be something you could write a normal library type for. Indeed if your language doesn't let you implement the constructs you need for this kind of type in a custom type in a library, that should be a red flag that your language isn't expressive enough for general-purpose use.
- hota_mazi 10y ago> (you can either assume all Java calls are non-null unless checked, assume all Java calls are nullable and force checking, or trust annotations; all these approaches suck in their own way) Agreed, which is why Kotlin has explored all of these options and ending up implementing neither. Look up "platform types".
- 10y ago
- jorgemf 10y ago> "Slightly cleaned-up Java with a bit of syntax sugar" And C is a "slightly cleaned-up assemble with a bit of syntax sugar". I think kotlin has a lot of features that Java (even Scala an Ceylon) doesn't have, moreover it forces you to use good patterns when programming (it got a lot of ideas of effective java book). I am curious why do you say Scala and Ceylon have killer features, what are those features that Kotlin doesn't have? Personally I have used Scala and I prefer kotlin over it, even Java over Scala.
- lmm 10y ago> And C is a "slightly cleaned-up assemble with a bit of syntax sugar". Going from machine-specific assembly to crossplatform C was a huge killer feature at the time. > I am curious why do you say Scala and Ceylon have killer features, what are those features that Kotlin doesn't have? Higher-kinded types and/or union types. Those are the real game-changers, even if they don't look like it in simple examples. More concretely, the real value proposition for moving from Java to Scala or Ceylon is "replace all your magic annotation/XML-based proxying/bytecode manipulation with ordinary library functions that follow the ordinary rules of the language".
- mike_hearn 10y agoThe term "killer app" refers to an app so amazing, people buy your platform just to use that one app. A killer language feature would be a feature so amazing, people use your language just to get that one feature irregardless of the rest. One property of a killer app is that people tend to know it when they see it. You don't normally need to educate people as to why they want your app, they already know they do. Kotlin does have a whole bunch of features and particularly DSL features (with more added in 1.1) to allow usage of "ordinary functions" in places where previously you might have used annotations or bytecode generation. But in practice the market doesn't seem to value these things all that highly, perhaps because most of the time, people are writing ordinary code that doesn't benefit much from them. It's tough to claim something is a killer feature when people aren't saying "We use Ceylon because it has HKTs" (by 'people' here I mean, more than one or two bloggers). If you look at any discussion of Kotlin then people do tend to identify killer features for them, but they're not normally type system features, they're more like interop or tooling related features. Ceylon and Scala teams recognise the importance of these things too, but the relative prioritisations have been different, so it isn't surprising that the results appeal to different market segments.
- afastow 10y ago> And if you are going to make all that effort, why would you not pick a language that offers some genuine killer features in return, like Scala or Ceylon? Ceylon because it's a ghost town language that no one uses and that only programming language enthusiasts have even heard of. That's a catch 22 but it's the truth. Scala because it's too different from Java for many Java programmers to be able to jump in and be immediately productive. It solves problems a lot of Java programmers don't even know they have. The fact that Kotlin isn't that much different from Java is its compelling advantage. And the places it is different, like non-null types, solve problems that almost every Java programmer is going to understand and relate to.
- lmm 10y ago> Ceylon because it's a ghost town language that no one uses and that only programming language enthusiasts have even heard of. That's a catch 22 but it's the truth. I know :(. It's just very frustrating to have seen Ceylon and Kotlin come out at roughly the same time with roughly the same goals, one better designed than the other, and then watched the other one win. > Scala because it's too different from Java for many Java programmers to be able to jump in and be immediately productive. Idiomatic Scala that makes extensive use of native-to-Scala libraries has this property; Scala written in a Java-like style doesn't. I think it's too early to say that Kotlin won't experience the same thing as an idiomatic Kotlin style and native-to-Kotlin libraries emerge. > It solves problems a lot of Java programmers don't even know they have. The fact that Kotlin isn't that much different from Java is its compelling advantage. And the places it is different, like non-null types, solve problems that almost every Java programmer is going to understand and relate to. I think you would have to have a very finely calibrated level of attention to notice null was causing you problems and not notice that exceptions, AOP magic and the like were also causing you problems. I mean I'm sure many Java programmers regard bizarre transactionality bugs ( http://thecodelesscode.com/case/211 http://thecodelesscode.com/case/211 is a good example ) as an unfortunate fact of life rather than something to be fixed by better languages - but I expect those same people would also regard null pointer exceptions as an unfortunate fact of life.
- afastow 10y ago