Live data from Hacker News

Learn Kotlin in Y Minutes

learnxinyminutes.com

61–70 of 239 posts

Re: Learn Kotlin in Y Minutes

#61
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…

Official support still matters. There is some inherent risk whenever you go in a direction not explicitly supported by the owner of your platform, and now that risk is gone.

Not only does official support matter, it matters much more than whether or not the language is good. I keep learning that lesson again and again in the hard, painful way.

Re: Learn Kotlin in Y Minutes

#62
post #25

I'm a bit disappointed that there's no metaprogramming support in Kotlin. Even Groovy had some AST-level transformators. Maybe we'll get some high-level API for writing APT-level tools in Kotlin itself ...

If you're looking for metaprogramming on the JVM, and like the semi-functional approach of Kotlin, you should definitely take a look at Clojure.

Re: Learn Kotlin in Y Minutes

#63
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…

Official support still matters. There is some inherent risk whenever you go in a direction not explicitly supported by the owner of your platform, and now that risk is gone.

You can use kotlin for more things than just Android. And before it had official support from JetBrains (for Android among others). The way it works in Android doesn't make any difference with other popular libraries as retrolambda, picasso, dagger, etc. Those aren't supported by Google and still used in a lot of Android apps.

Google only said they are going to collaborate more with JetBrains, which in my mind it translates in "we, developers, are not going to have incompatibility issues between kotlin and beta versions of the gradle plugin". (I want to highlight the word beta, because with stable versions it was weird you have any issue with kotlin).

Re: Learn Kotlin in Y Minutes

#64
post #47

Earlier quoted context omitted.

var = variable (can vary/change) val = value (constant) What can be mistaken?

I don't find it to be confusing but you'd get more autocomplete help if let was used for constants. l => let v => var

Very good point. Fortunately, it's only one keystroke saved.

Re: Learn Kotlin in Y Minutes

#65

> 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?

Kotlin as a language has expectations on IDE capabilities. I doubt the problem of accidentally typing "r" instead of "l" at the end of a keyword is as prevalent as someone typing "var" instead of "const" and not coming back to make it immutable. A quality compiler can warn about an unmutated mutable variable which solves all problems. Remember recently on the Java mailing list there was a lot of bikeshedding concerni…

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.

Re: Learn Kotlin in Y Minutes

#66
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…

The language itself isn't 'more cool' or better, but the risk profile of adopting it has dropped dramatically. That makes it much more interesting.

There weren't any risk before apart form the kotlin plugin not working with beta versions of the gradle build plugin. Using kotlin in Android is like using a library, and you don't have official support from Google for all popular libraries used in Android.

Re: Learn Kotlin in Y Minutes

#67
post #41

> 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?

I'm personally a fan of the Rust way, i.e. `let` for const bindings and `let mut` for mutable ones. I think it's fairly clear which is which, and having to type four extra characters to get mutability helps reinforce the notion of const being the default choice.

Sure, but Kotlin is more about being explicit and less about evangelizing one style of programming over another. It's very pragmatic in that way. There are plenty of scenarios where you're maintaining local state (properly encapsulated within a class, exposing a functional interface, etc) and you need mutable fields. Even plenty of scenarios where you want to operate on a value mutably in a function and then return it. It may seem confusing at first but in practice I've never mixed the two up.

But this most likely is because Scala uses val/var.

Re: Learn Kotlin in Y Minutes

#68

Earlier quoted context omitted.

Official support still matters. There is some inherent risk whenever you go in a direction not explicitly supported by the owner of your platform, and now that risk is gone.

Not only does official support matter, it matters much more than whether or not the language is good. I keep learning that lesson again and again in the hard, painful way.

Out of curiosity, What was your bad experiences?

Re: Learn Kotlin in Y Minutes

#69
post #47

Earlier quoted context omitted.

I don't find it to be confusing but you'd get more autocomplete help if let was used for constants. l => let v => var

Very good point. Fortunately, it's only one keystroke saved.

It could be two if it inserted the space for you!

Re: Learn Kotlin in Y Minutes

#70
post #47

Earlier quoted context omitted.

I don't find it to be confusing but you'd get more autocomplete help if let was used for constants. l => let v => var

Very good point. Fortunately, it's only one keystroke saved.

One keystroke, not two? I type l in Xcode then I'm typing in the variable name. You'll have to arrow down if it's the wrong one then hit return.

You can argue that it's really not much extra work but it all adds up. Especially when you try to code on a tablet, which I find myself doing occasionally.

Post reply on HN