Live data from Hacker News

Why Kotlin is my next programming language (2015)

medium.com

131–140 of 185 posts

Re: Why Kotlin is my next programming language (2015)

#131
post #69
post #44

Earlier quoted context omitted.

Scala is still there, still growing, and a much better language. Kotlin is founded on this anti-intellectual rejection of Scala's advanced features... only to then add them back in piecemeal. So rather than a single powerful general feature like implicits or higher-kinded types you have language-level special cases like extension methods and specific nullness operators. (Don't get me wrong, there are plenty of things…

> Scala is still there, still growing, and a much better language. Kotlin is founded on this anti-intellectual rejection of Scala's advanced features... Each time someone brings up Scala there comes this weird "people who don't like it are anti-intellectual" - well no, people don't like it because it looks weird, had for the longest time abyssimal IDE support, tries to do things which have been solved in production b…

> Each time someone brings up Scala there comes this weird "people who don't like it are anti-intellectual"

The whole "Kotlin comes from industry, not academia. It solves problems faced by working programmers today." is pretty clearly anti-intellectual. I come from industry, not academia, and the Scala type system solves problems I face as a working programmer every day that I couldn't solve in Kotlin (or any other language without higher-kinded types), thank you very much.

> people don't like it because it looks weird

Weird how? I find it looks very much like Python or Ruby.

> had for the longest time abyssimal IDE support

Shrug. Not my experience.

> tries to do things which have been solved in production by itself (see SBT vs Maven)

Just ignore that nonsense and use maven.

> and is a mishmash of more or less every idea that was floating around mixed into one language.

Hardly. It's got a small number of powerful features that get out of your way and let libraries get on with it. Kotlin is far more of a mishmash because it has a whole bunch of special-case functions in the language (e.g. special operators for dealing with nulls, rather than just being a language that people can write an optional type in).

> Kotlin has a very specific focus: Being usable for a working Java programmer, who doesn't have three years to learn every weird idea Scala tries to shove down your throat. It uses existing tools, existing Java collections and enhances them instead of saying "well, we do everything new, because we know how to do it 'better' and we don't care for your existing code."

Scala doesn't shove anything down your throat. You can use the Java collections in Scala if you want - I did when getting started - it's just that it's really valuable to have immutable collection types (actually even in pure Java this is true - one of the reasons Guava is used in almost every project is to be able to have ImmutableList etc. types - but it's better if you can do it without having half the class be "throw new MethodNotSupported()").

Re: Why Kotlin is my next programming language (2015)

#132
post #129
post #89

Earlier quoted context omitted.

It is interesting that when I considered next language to write a side-project in, I was choosing between Ceylon and Kotlin. In the end I did choose Kotlin. My reasons included: * support in IDEA * focus on java interoperability * nice interop with android but the main thing probably was, that I trust JetBrains that they will support Kotlin in the long term, while I don't think RedHat has any projects depending on th…

Well in reality I choose Scala, largely because it has a level of maturity and ecosystem support (both libraries and other tools) that neither Ceylon nor Kotlin can match. But I'd use Ceylon rather than Kotlin because I think it's a much better designed actual language (see cousin post for examples). I personally dislike IDEA (prefer Eclipse), and I don't think Kotlin actually has any better Java or android interop t…

> they just make more of a fuss about it in their marketing

This succinctly describes many aspects of Kotlin.

Re: Why Kotlin is my next programming language (2015)

#133
post #44

Earlier quoted context omitted.

Scala is still there, still growing, and a much better language. Kotlin is founded on this anti-intellectual rejection of Scala's advanced features... only to then add them back in piecemeal. So rather than a single powerful general feature like implicits or higher-kinded types you have language-level special cases like extension methods and specific nullness operators. (Don't get me wrong, there are plenty of things…

Anti-intellectual? More like complexity, let's be honest about motives here: it isn't "we hate types" it is "I have no idea what is going on here anymore." The "start over again and try do it right this time" is quite pervasive in PL, and even if it keeps on leading to the same problem, the motivation is always well meaning.

The line about "Kotlin comes from industry, not academia. It solves problems faced by working programmers today." is pretty naked anti-intellectualism IMO.

Re: Why Kotlin is my next programming language (2015)

#134
post #17
post #14

Earlier quoted context omitted.

I'm thinking of client machines. People balk at installing Java these days. Is there a way to get the JVM without Java? Is Kotlin not capable of being a client application?

You just package the JVM with the application itself. Create a .bat/.exe/.sh/binary file that calls the JVM with your program as the argument. It's simple, but it will increase the download size of your program significantly (unless your program is huge - then it doesn't matter)

Or look at the javapackager tool that comes with JDK8.

Re: Why Kotlin is my next programming language (2015)

#135

>Kotlin costs nothing to adopt! It’s open source, but that’s not what I mean here. What I mean is there’s a high quality, one-click Java to Kotlin converter tool, and a strong focus on Java binary compatibility. The costs of adopting a new language are greatly more significant than implied here. The time it takes to learn it. The time it turns to learn the tools that are specific to it. And if you put it into product…

My experience has been that the learning curve for Kotlin is extremely shallow if you're an experienced Java developer. This is not just my experience but also the experience of building a team that's working with Kotlin all day.

One reason the cost is low, is that there aren't really many tools specific to Kotlin (or any, really). You can use the same IDEs, the same build toolchains, the same libraries, even the same standard library as regular Java.

Re: Why Kotlin is my next programming language (2015)

#136

> Kotlin comes from industry, not academia. It solves problems faced by working programmers today. As an example, the type system helps you avoid null pointer exceptions. I'm sorry but you just undercut your own anti-intellectualism better than I could right there. (There exist languages which have guarded against this without loss of expressive power since before Java and, oh, are from academia.)

Sometimes I think I should change that paragraph because it too often gets interpreted as generically anti-academia, which then triggers people who think I'm anti-intellectual.

Note the very important part of that statement: It solves problems faced by working programmers today.

Academic PL research can have that property. Pizza went on to be the foundation of Java generics, there's a ton of excellent compiler and GC theory that comes from academic research and so on. And of course a few of the ideas in Haskell and others are leaking into the mainstream.

But when it comes to handling null pointer errors, sorry, it's insufficient to say "some languages popular in academia don't have null". So what? Working programmers today hardly use such languages. They very much rely on languages which do have nulls, and APIs which use them, and yet the only language that came out of academia in recent times which has serious production usage is Scala, which has ... nothing to say on the topic. Except, oh, an option type. Which can also be null, and which even C programmers can easily have. It's simply not comparable to language integrated support with backwards compatibility.

It would have been nice if academic research had identified up front the best set of usability tradeoffs for adding optionality into a backwards compatible language, but nobody did, so JetBrains had to do it themselves.

Re: Why Kotlin is my next programming language (2015)

#137
post #133

Earlier quoted context omitted.

Anti-intellectual? More like complexity, let's be honest about motives here: it isn't "we hate types" it is "I have no idea what is going on here anymore." The "start over again and try do it right this time" is quite pervasive in PL, and even if it keeps on leading to the same problem, the motivation is always well meaning.

The line about "Kotlin comes from industry, not academia. It solves problems faced by working programmers today." is pretty naked anti-intellectualism IMO.

You have a lower standard for anti-intellectualism than I do, I guess. From wiki:

> Anti-intellectualism is hostility towards and mistrust of intellect, intellectuals, and intellectual pursuits, usually expressed as the derision of education, philosophy, literature, art, and science, as impractical and contemptible. ... In public discourse, anti-intellectuals are usually perceived and publicly present themselves as champions of the common folk—populists against political elitism and academic elitism—proposing that the educated are a social class detached from the everyday concerns of the majority, and that they dominate political discourse and higher education.

The above sentence fails that test, it merely states its roots and goals can be different from academic pursuits. And it is mostly correct: at best academic work is focused on tomorrow, not today..and at worst it is focused on today but should be focused on tomorrow.

Re: Why Kotlin is my next programming language (2015)

#138

Kotlin is unquestionably a very large improvement over plain old Java. I fear it might be very hard to make the Android community adopt it massively though, unless Google pitches in and supports it officially.

The Android community has already adopted it pretty significantly (join the #android Kotlin slack and see for yourself). And this was done without any official support for Google because... it's not necessary: Kotlin works out of the box. Which is one of Kotlin's strengths.

http://www.indeed.com/jobtrends/q-android-q-kotlin.html

Re: Why Kotlin is my next programming language (2015)

#139

> Kotlin comes from industry, not academia. It solves problems faced by working programmers today. As an example, the type system helps you avoid null pointer exceptions. I'm sorry but you just undercut your own anti-intellectualism better than I could right there. (There exist languages which have guarded against this without loss of expressive power since before Java and, oh, are from academia.)

Sometimes I think I should change that paragraph because it too often gets interpreted as generically anti-academia, which then triggers people who think I'm anti-intellectual. Note the very important part of that statement: It solves problems faced by working programmers today . Academic PL research can have that property. Pizza went on to be the foundation of Java generics, there's a ton of excellent compiler and G…

> And of course a few of the ideas in Haskell

A few? Don't you feel like you're underselling the impact Haskell had had on other languages?

> he only language that came out of academia in recent times which has serious production usage is Scala,

What are your qualifications for serious production usage? Would ocaml count by your standards? Haskell also has increasing production usage, though I'm sure you don't count it. Swift (if you don't count it now, you will)? Rust?

> It would have been nice if academic research had identified up front the best set of usability tradeoffs for adding optionality into a backwards compatible language,

That's not enough. It would have to be more convenient to use optionals than null or programmers in that language would have to be convinced optionals are better.

In an existing language that uses null pervasively, it would be hard to get a critical mass of legacy code which uses optional.

Re: Why Kotlin is my next programming language (2015)

#140
post #41

I tried Kotlin during the Surprise Language round of Codeforces, a programming competition. I found it to be more verbose than a typical modern scripting language. Maybe it's the result of choosing the least of the evils for what it's trying to accomplish. The other drawback: the documentation. Kotlin's reference documentation (looking up how to properly use a call) does not have any examples. I'm not even talking ab…

The Kotlin reference is not supposed to be used for finding methods. The way to go is to use auto completion in an IDE. If you type `myArray.sort `, you get all one needs, including `sort`, `sorted`, `sortBy` (which you needed). Alternatively you could search the reference page for Array or MutableList or MutableMap, not sure what you wanted: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/ https://kotlinl…

I had something like this:

    var heights: Array > = ... //populating the array
    heights.sortBy { it.second };
It was not obvious at all that I had to use curly braces. The documentation says:

    inline fun > MutableList.sortBy(
    crossinline selector: (T) -> R?) (source)
This is after I figured out that I'm not supposed to use sortWith (I never figured out how to use this one)
Post reply on HN