Live data from Hacker News

Kotlin 1.0 Released: Pragmatic Language for JVM and Android

blog.jetbrains.com

51–60 of 112 posts

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#51
> 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.)

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#52

Earlier quoted context omitted.

how do you do conditionals or loops in maven?

You can use the maven polyglot plugin [1] to write your POM in something other than XML. It's fairly new, but it's there. We use it in JRuby to write our POMs in Ruby. As an example of a loop: https://github.com/jruby/jruby/blob/8e29ae1302e7aa989b8808f7... [1] -- https://github.com/takari/polyglot-maven

Why can't I use Java with Polyglot?

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#53
Kotlin 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

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

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.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#54
post #22

Earlier quoted context omitted.

So I think gradle has a lot of problems, but having access to Groovy anywhere is a good thing. You can always make your builds do what you want. And as in all things if your code gets too complicated you need to refactor, extract logic into methods/classes, etc.

You can always make your builds do what you want, but the flipside is you can never understand what someone else is doing with their build. I don't think the build system is the place for turing-complete code. Business logic certainly doesn't belong there. Keep the build simple and standardized, and keep code in code.

I've arrived at the opposite opinion over time ... I think people need to recognise that a build system is code. When we pretend it isn't we ultimately end up contorting the system to make up for the missing flexibility. A lot of it looks declarative, but it is not always the case. Sometimes you want imperative constructs. The build should be recognized as code, maintained as code and use a first class language suited to the job.

I do have a problem with Gradle which is that it is almost entirely magical unless you are a pretty advanced Groovy programmer to understand how it is doing what it is doing. I have never felt more disoriented than when trying to learn how to customise a simple aspect of my build and having people post snippets that work but seem completely disconnected from anything else in the build process.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#55

Earlier quoted context omitted.

You can use the maven polyglot plugin [1] to write your POM in something other than XML. It's fairly new, but it's there. We use it in JRuby to write our POMs in Ruby. As an example of a loop: https://github.com/jruby/jruby/blob/8e29ae1302e7aa989b8808f7... [1] -- https://github.com/takari/polyglot-maven

Why can't I use Java with Polyglot?

I don't know much about the development of the project, simply that it exists and is usable. I'd file an issue with the project and see what comes of it.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#56
Kotlin 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.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#57
post #36

Earlier quoted context omitted.

The point of the class instance (the "singleton") is not performance, it's that it exists independently of any instance of the type, so it can be used for factories and such. This however, is not my main concern, and as you remarked, it does not fit very well in OO, which is why it isn't in my proposal. On to the interesting part. You want multiple adapters, rather than multiple interfaces, precisely because you want…

Thanks for the explanations. Yes, there seems to be an impedence mismatch when trying to import the concept of Haskell type classes to OOP languages. WRT a combined adapter class, it'd look like this in Kotlin: class FooBarAdapter(val x: Baz, private val y = Foo(x), private val z = Bar(x)) : Foo by y, Bar by z A bit bloaty, but still a single line of code. (I know you already know this, I'm writing it here for Kotlin…

Wow, actually this hadn't made it to my bag of trick yet.

It's very nice, though I can see that becoming quite heavyweight when you nest these calls (either heavy from the overhead, or from the syntax - at least you get to decide).

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#58
post #56

Kotlin 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),…

One 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.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#59
post #19

I'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…

> ...what I'd call "crispness": you can write terse code that is actually understandable.

What an awesome term, I love it.

Re: Kotlin 1.0 Released: Pragmatic Language for JVM and Android

#60
post #13
post #7

Earlier quoted context omitted.

Can 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.

There's no clear separation between build config and random Groovy expressions. There's not even a spec for what a .gradle file looks like. That's fine for "get this done quickly", but ultimately it encourages people to put one-off hacks in the build file that become a maintainability nightmare. (And because its "config" files are arbitrary turing-complete code, its IDE integration is never going to be as good as Mav…

There's a "spec" for Groovy at its website groovy-lang.org but that site's owned by a private individual so it could be pushing it to call it a real spec.
Post reply on HN