32 ms·
Kotlin 1.0 Released: Pragmatic Language for JVM and Android
- thecupisblue 11y agoBeen using it for a while, glad 1.0 is out! This is an amazing replacement for Java on Android and hope it gets more public recognition now that it's officially out.
- meddlepal 11y agoBeen working with it as well since last summer and following it for a lot longer than that. Glad to see they've reached 1.0!
- zserge 11y agoI designed my reactive mvvm micro-library (https://github.com/zserge/anvil https://github.com/zserge/anvil) for Android with kotlin in mind, and so far it saved me lots time. Kotlin+Android is a great choice.
- zserge 11y agoAnd here are some examples of using Anvil with Kotling: https://github.com/zserge/anvil-kotlin-demos https://github.com/zserge/anvil-kotlin-demos
- thecupisblue 11y agoI heard about Anvil, it rocks! Great job man!
- sandGorgon 11y agoeven more interesting is that Spring Boot now supports Kotlin [1]. So you can use https://start.spring.io/#!language=kotlin https://start.spring.io/#!language=kotlin to generate a gradle project with Spring Boot. [1] https://spring.io/blog/2016/02/15/developing-spring-boot-applications-with-kotlin https://spring.io/blog/2016/02/15/developing-spring-boot-app...
- claudiug 11y agokotlin looks like swift for java. I hope google will remove java and start adding kotlin as a first citizen :)
- Alphasite_ 11y agoThe trouble between google and oracle wasn't about Java, it was about the Java Standard Library and Harmony. Which wouldn't really be solved by Kotlin.
- rabenblut 11y agoIrrelevant, Kotlin is still better than Java
- merb 11y agoactually I'm still unsure about kotlin. some things are really great some things are not. I mean i will still use kotlin, especially for libraries since it is great for that. however somehow I still missed something on top of Executors and CompletionStage. And I'm totally unhappy about "So, why doesn’t Kotlin have its own package manager, or its own build system? Because there’s already Maven and Gradle, and re-using their huge number of plugins is crucial for many projects." The answer would be totally valid, however people who worked with maven, gradle, ant or even sbt (which isn't offically supported) could be unhappy. all of these build systems are useful, but not actually great. I mean you could work with them but it's not actually great to use them.
- jermo 11y ago> I still missed something on top of Executors and CompletionStage. You could use RxKotlin. It has Schedulers and Observables/Single/Completable for interacting with async tasks. https://github.com/ReactiveX/RxKotlin https://github.com/ReactiveX/RxKotlin
- Nutomic 11y agoCan you name any criticism of Gradle? I've used it for years now (for Android development). It's steadily being improved, and is really good in my opinion.
- merb 11y agoActually criticism is mostly personal however there are a few: - I dislike the DSL // not a really useful criticism I know. - Some things needs Groovy which isn't a mainstream language - Had Bad support for Scala, which I use heavily mostly resolved since 2.2 and thanks to linkedin newer version even have twirl + playframework support. - sometimes the syntax file of the DSL couldn't be highlighted in eclipse / intellij - Bigger build files could be really slow (mostly resolved in newer versions) Btw. whats really really good on Gradle is the dependency resolution, which is really fast compared to something like sbt.
- 11y ago
- norswap 11y agoI've been using Kotlin for work (I'm a PhD student, so work is to be understood in a peculiar fashion) and I'm really liking it. It's a much needed upgrade to Java whose fundamental advantage is what I'd call "crispness": you can write terse code that is actually understandable. In particular, the notion of inlining closures allows for efficient functional programming and great DSLs. In comparison to Scala, Kotlin is much less advanced, but much much simpler. Like said earlier, it's easily as terse as Scala. Scala, however, is much more expressive (what I'd give for typeclasses...) and that sometimes hurts in Kotlin as it does in Java. There's also Ceylon (JVM language by Red Hat) who is seemingly in the same niche and which I very much wants to experiment with. From what I've read so far, Ceylon seems conceptually more elegant and more powerful than Kotlin. The open question is whether it can match Kotlin's crispness. It feels a bit early for a release however. The compiler is still completely wonky. Inference sometimes fails on things that should be completely trivial. It is particularly bad at taking return types into account. It's fully usable, but expect to work your way about some linguistic unpleasantness (or outright bugs). Also, for some reason, Kotlin seems big in Japan.
- mike_hearn 11y agoBy typeclasses, do you mean structural typing a.k.a. duck typing a.k.a. Go-style interfaces? I don't personally understand why people care about that: a simple structural match on names/parameter types doesn't seem like a strong enough signal that someone actually intended to implement such an interface. But ... type classes can be implemented on the JVM relatively efficiently these days. I threw together a simple Kotlin version a few weeks ago that let you write something like: val foo = Foo() val bar = foo.dynamicCast<Bar>() where Bar was an interface that Foo could have implemented but didn't. It worked, but I didn't see any value in it for myself, and it didn't use the latest JVM reflection APIs so it was slower than a normal interface call. If there's some big population of people who really want this in Kotlin and would be much happier if they had it, then I might sit down and reimplement it on top of Remi Forax's proxy2 framework, which should give 1:1 native performance.
- lmm 11y agoNo. Structural types are called structural types. The best known typeclass implementation is that of Haskell where they're built into the language, but Scala has them as a pattern implemented with implicits; I can try to explain the concept here if you like but honestly there are probably better explanations out there. Typeclasses are more powerful than structural types in that the implementation doesn't have to be there already (i.e. you can have an automatically resolved adapter). You might be able to hack an implementation by combining extension methods with structural types (though given the internals of how extension methods are usually implemented on the JVM I doubt it). They also allow a way to do "static virtual methods" i.e. polymorphic methods that you don't need an instance to invoke, which are used for things like Monoid#zero. Finally they provide a nicer way to express F-bounded polymorphism (i.e. the constraint on Enum or Comparable that we try to express in Java as Enum<E extends Enum<E>> or Comparable<T extends Comparable<T>>, which is clunky and doesn't actually fully constrain implementations the way it's intended to).
- winterbe 11y agoKotlin is currently my favorite alternative JVM language. Kudos to all collaborators for the great work. After 5 years of hard work, you finally made it! Here's a little starter project for Kotlin webapps using Spring Boot and React.js, I made a while ago: https://github.com/winterbe/spring-kotlin-react-demo https://github.com/winterbe/spring-kotlin-react-demo
- herval 11y agoMy humble contribution to the hipster-stack-starter-pack: https://github.com/herval/gradle-kotlin-docker-multiproject-boilerplate https://github.com/herval/gradle-kotlin-docker-multiproject-... :-)
- wcummings 11y ago>Building a JVM container with Docker. So you can put your interpreter inside your JVM inside your Docker container inside your Kubernetes inside your VPS inside your OS and be happy. I want to cry.
- mahmoudimus 11y agoCongratulations to Andrey and the rest of the JetBrains team. This really has been a long time coming. I've been following and experimenting with Kotlin now for the past year or so and it definitely solves a lot of Java's pain points without having to reinvent the way one thinks about programming languages. The interoperability and backward compatibility is one of the most useful features, meaning I don't have to wait for an entire ecosystem to develop around it. The tooling is also incredible and will only get better. Concurrency support with Quasar and Comsat makes it relatively effortless without reinventing new libraries. Overall, Kotlin, IMHO, is one of those items in the "Pro"s section on any shop seriously evaluating a JVM stack. Especially with Java9 on its way, it's only going to get better.
- azth 11y ago> Especially with Java9 on its way, it's only going to get better. What's Java 9 going to add that Kotlin can benefit from?
- rattray 11y agoPresumably, they coexist; if you have a lot of old Java code, upgrading to Java 9 will likely be much easier than translating to Kotlin, but you still have a healthy codebase.
- pjmlp 11y agoNot much, other than VarHandles, JIT plugins and the overall JVM improvements maybe. The real juice will be in Java 10, assuming value types, proper generics, JNI replacement and AOT support get delivered.
- crudbug 11y agoCongratulations on this release. I see with Project Rider, JetBrains clear strategy to support major platforms - JVM, Native, Web, CLR. Is there a CLR backend planned for Kotlin ?
- yole 11y agoThe Kotlin team does not have any near-term plans to work on the CLR backend. However, there are people at JetBrains who want one, so it's possible that it will appear at some point in the future.
- pjmlp 11y agoIt would make a great portable language between Android and Windows Store, removing the need to touch JNI in Android like we are currently forced to do for any major OS APIS via C++.
- crudbug 11y agoI started looking at Kotlin docs [1]. For higher order functions support, fun lock(lock: Lock, body: () -> T): T { } Is there any technical reasons why normal function declarations are not using '->' as a return operator ? fun hello(name: String) -> String { println(name) } Swift [2], Rust & others are using it. It will just make the experience uniform with consistent Functional Types [1] https://kotlinlang.org/docs/reference/lambdas.html https://kotlinlang.org/docs/reference/lambdas.html [2] http://fuckingswiftblocksyntax.com http://fuckingswiftblocksyntax.com
- lmm 11y ago: T is consistent with values, it's the way of saying a thing has a type. It makes for much more consistency when refactoring a function, and (at least in Scala) supports the Uniform Access Principle style. def lock(...): T = ... val lockResult = lock(...): T In Scala at least "=> T" is the syntax for a lazy T (i.e. a function of no arguments that returns T), and so your "hello" reads like a function that returns a lazy String.
- vbezhenar 11y agoCongratulations to everyone involved. I like Kotlin and I hope to see it as my main language for Java platform. I used it and it really "clicked" for me. Almost everything was designed the right way in my opinion.
- wellpast 11y ago> Talking about [Kotlin] lines of code, the number of these in open repositories on GitHub is growing exponentially over time. This could also mean you've designed a verbose and turgid language. A better metric might be # of projects using Kotlin. (For the record, I'm actually really excited about using Kotlin, I just found it somewhat hilarious to boast about exponential growth of LOC.)
- mythz 11y agoKotlin is a beautifully designed language: small, modern + statically typed that's naturally terse and elegant - ideal for both OOP and LINQ-like/functional programming: https://github.com/mythz/kotlin-linq-examples https://github.com/mythz/kotlin-linq-examples Thanks to JetBrain's tooling prowess it also has great integration with Android Studio - Light years better for functional programming than Java 1.7: https://github.com/mythz/java-linq-examples https://github.com/mythz/java-linq-examples Which can seamlessly integrates with Java within the same project. Google/Java/Android Devs are sitting on a unrealized gold-mine of productivity with Kotlin, should be the modern successor for Android.
- runT1ME 11y agoYou're really comparing a small subset of what "LINQ-like functional programming" is to the (small) pieces that Kotlin can do. LINQ is not (just) an interface over some collections. It is a comprehension syntax (that kotlin doesn't have) that works on any types that have Select/SelectMany/Where. This gives you a lot more power than what Kotlin gives you, as you can 'extend' other things that don't inherit from an IEnumerable<T>; for instance Task or a custom data type that has its own inheritance hierarchy. The 'comprehension' part means you can deeply nest things (similar to scala's for compehension) without building up a stack of {}. This is quite common when doing asynchronous programming, and Kotlin doesn't really help you out at all here.
- mythz 11y agoIt's not a small subset, it's the most popular subset that .NET developers use LINQ for everyday as identified by C#'s 101 LINQ Examples and compares them against the equivalent code in Kotlin. The C# examples does use the LINQ SQL-like DSL whereas other languages get by with a more readable and less indirection version using functional API's available on collections. It's up to the developer which they prefer however the LINQ DSL is no more powerful than regular function chaining with lambdas. LINQ also allows capturing Expression Trees however that's only useful for developers creating LINQ providers or where they need to capture and rewrite/reproject the expression. None of these examples are in the published LINQ 101 examples as they're usefulness is limited to a small niche of use-cases.
- zmmmmm 11y agoKotlin sort of feels like Groovy "done properly" (with no disrespect to the authors of Groovy). Groovy kind of evolved in an opportunistic, unplanned manner and ended up with millions of features, cool whiz bang aspects that look awesome that don't always turn out well when you use them on a large scale. Kotlin seems to capture the same ideas (highly pragmatic, maintain perfect bidirectional compatibility with Java), but done in a much more thoughtful manner. Fingers crossed it works out.
- vorg 11y agoOne example is Kotlin was designed to be statically typed from the ground up, whereas Groovy's static typing was added 9 yrs later (mid-2012) as an afterthought.
- jkot 11y agoOne of authors of groovy works on kotlin.
- yole 11y agoThis used to be the case a while back, but James is no longer working with us.
- eggy 11y agoI like Kotlin, but I prefer Xtend. I find it to have even less verbosity and more expressiveness, and it uses the same Java types. I'm using Eclipse with it for now, but I prefer Android Studio. Congrats on the release!
- lmm 11y agoI understand the author of Groovy said he'd never have started the language if he'd known about Scala.
- daviddumenil 11y ago"I can honestly say if someone had shown me the Programming in Scala book by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy." http://macstrac.blogspot.co.uk/2009/04/scala-as-long-term-replacement-for.html http://macstrac.blogspot.co.uk/2009/04/scala-as-long-term-re...
- softinio 11y agoMust admit I wish Jetbrains just contributed more of their time on existing open source languages instead of creating a complete new one. There is enough languages out there and this is one more thing i wont have time to look at :) Congrats though well done on release.
- distances 11y agoMostly Kotlin brings a real alternative to Android. The other languages either don't run on JVM or are somehow else unsuitable, such as due to unacceptable startup times. It's almost like Kotlin was designed for Android to bring new life to its ancient Java version.
- hyperpallium 11y agorequest: a dex of the compiler and any needed jars, so you can compile on an android device.
- kosiara 11y agoI’m already using Kotlin in my Android projects. So far it’s great! I’d also done a presentation about Kotlin during our company’s Lightning talks. Take a look here – Kotlin Developer Starter in Android projects. https://t.co/oVPJw1YIGa https://t.co/oVPJw1YIGa