Live data from Hacker News

Learn Kotlin in Y Minutes

learnxinyminutes.com

231–239 of 239 posts

Re: Learn Kotlin in Y Minutes

#231
post #151

Earlier quoted context omitted.

I like that a lot, but the `to` syntax bugs me. Why not a colon, or Scala's `->`?

You type "->" faster and easier then "to"?

No, but it's visually clearer to me at a glance. It feels weird using letters, let alone full English words, to describe a mapping or anything else that I think a symbol is more suited for.

To me it would feel like assigning a variable with:

   a equals 6
   n equals "A"
Just feels icky, somehow.

Again, that wouldn't dissuade me from using the language whatsoever. It's only a minor irritation.

Re: Learn Kotlin in Y Minutes

#232

Earlier quoted context omitted.

I like that a lot, but the `to` syntax bugs me. Why not a colon, or Scala's `->`?

Because "to" isn't actually syntax at all. It's an infix function that creates a Pair. You can alt-click it in the IDE to go to the definition.

`->` in Scala is also just a method, but I think it's fair to call such things syntax even if they're not true "baked-in" language syntax.

Re: Learn Kotlin in Y Minutes

#233
post #55

Earlier quoted context omitted.

> The fact that things are shorter to declare doesn't make it better. It makes it less readable. That's not a hard and fast rule. There are obvious inflection points. A 200 character long identifier is less readable than a 20 character identifier in almost all cases. A 1 character identifier is less readable than a 8 character identifier in almost all cases. Somehwhere between those extremes is the sweet spot, and it…

OK. Let's start writing 1 letter variables then. Shorter code. Better code.

The only way this comment makes sense is if you completely misunderstood what I said.

Re: Learn Kotlin in Y Minutes

#235
post #173

Earlier quoted context omitted.

Criticism can be useful if constructive.

But that criticism wasn't constructive, so...

it was constructive in the sense that the debate waste time from the real issue. But feel free to keep adding noise and fighting for syntax sugar.

Re: Learn Kotlin in Y Minutes

#236
post #5

Kotlin is the new Swift/Golang #hype

Not really, it's more like "Oh my god we don't have to use Java any more". I don't think it is particularly loved on it's own, it's just much better than Java. Swift is similar in that iOS developers don't have to use Objective C any more, but actually looks like a nice language in its own right. I think although Kotlin is going to be an improvement for Android development, it's not going to change much unless Google…

Wasn't scala supposed to do that?

Re: Learn Kotlin in Y Minutes

#237
post #187

Earlier quoted context omitted.

Probably everyone will try to hide your comment but that's the truth, there hasn't been a worse ecosystem than Android, learning the Android SDK it's so painful that even if they choose a decent language like Python to support it won't change the fact that the APIs would still be called in the same way, just look at the examples, same just sugar-coated flavor: https://github.com/JetBrains/kotlin-examples/blob/master/…

What is wrong with that example?

It is 98% scaffolding and ceremony. The exposed android API is just red tape, that is exposed for no good reason. Good API only expose what matters.

Re: Learn Kotlin in Y Minutes

#239

Earlier quoted context omitted.

Am I being a complete noob that only knows Python (I am) if I ask: Why do you need to declare that something is a mut or string or whatever? Python doesn't seem to need such extra lines with obvious declarations.

Dynamic languages can convert types in runtime (so 1 + "f" = "1f") and not so many languages (not only dynamic) cares about mutability.

From quick check, it looks like Java can do this coercion, and it's not dynamically typed.
Post reply on HN