Live data from Hacker News

Learn Kotlin in Y Minutes

learnxinyminutes.com

101–110 of 239 posts

Re: Learn Kotlin in Y Minutes

#101

Earlier quoted context omitted.

The problem isn't typing, but reading. Maybe other people's brains work differently than mine, but I'm sure I will be slightly slowed down by this.

When it comes to reading it is very clear in the IDE. val variables look normal (since immutability is encourage), var variables are underlined. You get used to it very quickly

That does help a lot.

I'm happy to be dependent on my IDE.

Re: Learn Kotlin in Y Minutes

#102
post #94

Earlier quoted context omitted.

It's obviously very strongly influenced by Scala, to the point of adopting a number of its syntax decisions that are considered questionable (procedure syntax, infix notation, "=" function definitions). I will echo what the others have said; it's not what I would choose, but in practice it's never been a problem when I'm writing Scala.

Why are Scala's "=" function definitions questionable? It makes absolute sense since a function should return a value.

They might be referring to the update methods:

  val array = new Array[String](10)
  array.update(7, "hello")
  array(7) = "hello" // simply calls out to update

Re: Learn Kotlin in Y Minutes

#103

> Declaring values is done using either "var" or "val". "val" declarations cannot be reassigned, whereas "vars" can. I wonder why they decided on these very mistakable names. Why not const/constant/cons/whatever else just as long it's distinguishable from each other?

In my experience as someone whose been writing scala for a couple of years (which also uses val/var), it has 100% never been confusing or a problem.

Yep. I think the names themselves are quite unambiguous to boot. A variable is something that varies in value, meaning it can be changed. A value is always that same value; 5 is never 6. Pretty straightforward if you ask me.

Re: Learn Kotlin in Y Minutes

#104

Earlier quoted context omitted.

What kind of sugar are you looking for? I'd like to have first-class comprehensions in any language I use, but having decent map/filter/reduce|fold implementations is good enough for the most part. (1..100).map({ it + 10 }) Doesn't seem so bad.

Mutable hashmap/associative array/whatever literals like: var map = {"a": 6, "b": 12} [Whatever list type is most common/idiomatic in Kotlin] literals like: var list = [1, 2, 3] etc. Plus list/map comprehensions like Python or Haskell, as you mentioned. Not a big deal or anything. It's only a little bit of extra typing. And the syntax sugar they do add is definitely a massive step-up over Java. I know it'd be hard to…

While somewhat longer, you do have

    var map = hashMapOf("a" to 6, "b" to 12)
    var list = listOf(1, 2, 3)
This is still not Java-level verbosity.

Re: Learn Kotlin in Y Minutes

#105

It looks like there's been a very conscious effort to strike a midpoint between Java's familiar clunkiness and Scala's hipster experimental side. I think that's a good thing, you end up with a language that feels pragmatic and powerfully practical.

I've been told that a big selling point for Kotlin is that it was developed from actual usage and production rather than some of the more academic languages solving abstract (although still interesting) problems that day-to-day developers may not care much about.

Re: Learn Kotlin in Y Minutes

#106
the whole kotlin debate is just a misguided stab at solving the pain that is programming for android.

everyone everywhere hates android dev work. so they think that it must be java. no, java sucks, but kotlin sucks just the same. the problem is the android ecosystem as a whole. the ever changing apis. etc.

wasting time on java vs kotlin is absurd with so many other real problems.

Re: Learn Kotlin in Y Minutes

#107
post #9

In terms of why we'd want to, there is this note here: https://kotlinlang.org/docs/reference/comparison-to-java.htm... Other factors to consider are tools support, how often interoprability with java libraries causes problems. Would be nice to hear from someone who has used it a bit about what the state of these is?

To me the most promising aspect seems to be async-await on Android. It'd eliminate so much frustration in developing for that platform.

In general, after bouncing between various desktop, mobile, and web-based technologies, I've come to the conclusion that any binding/event-based GUI system needs some sort of async-await or futures support to be truly workable. Otherwise, performing background tasks without locking up the UI involves way too much boilerplate and tends to blow up the architectural complexity of the application.

Re: Learn Kotlin in Y Minutes

#108
post #106

the whole kotlin debate is just a misguided stab at solving the pain that is programming for android. everyone everywhere hates android dev work. so they think that it must be java. no, java sucks, but kotlin sucks just the same. the problem is the android ecosystem as a whole. the ever changing apis. etc. wasting time on java vs kotlin is absurd with so many other real problems.

God, what a useless post. If you don't like Android development don't waste your time with it.

Re: Learn Kotlin in Y Minutes

#109
post #10

Honestly I could never really get into Kotlin. I like the features of the language - and would love to have many of them in plain ol' Java - but the syntax just feels wrong to me and I've not been able to get over it.

I find it a huge improvement over Java, but I wish it would have more syntax sugar for lists/arrays/maps like Swift and dynamic languages do. The mix of "hip" programming language constructs with unchanged Java verbosity feels weird to me. But if I were making an Android app, I'd definitely try to do it with Kotlin first.

what is not a improvement over java?

Re: Learn Kotlin in Y Minutes

#110
post #51

I like kotlin a lot, but suddenly there are a lot of articles in the front page about it. Kotlin isn't more cool because Google announced yesterday it is going to use it in Android. Kotlin is the same good language it was 2 days ago! (rant over) If you want to learn kotlin go to the official docs and tutorial, they are as good as the language: http://kotlinlang.org/docs/reference/ And you don't need to install anythi…

It IS cooler, because everything that Google touches becomes gold, according to HN.
Post reply on HN