Welcome little green droid

New JVM alternative Kotlin M2 appears

Chris Mayer
kotlin

The open source language being developed at JetBrains HQ gets its second outing, improving on the first glimpse and offering some new tidbits to the Java alternative

The latest in the crop of Java alternatives that runs on the
JVM, Kotlin has reached its second milestone with some big steps
made along the path towards its first full version.


The debut milestone’s splash
garnered 800 downloads, perhaps a
slightly disappointing number, but this could well sky-rocket with
further releases. The release back in April did bring with it
a plugin for IntelliJ IDEA, a standalone compiler, a
standard library and build tools, which as you’d probably agree,
was the bulk of the work needed for Kotlin.

The release also sparked lengthy discussions in the
Kotlin 
forum and issue
tracker
, with many converts providing useful feedback -
which the team have found invaluable for improving upon the initial
appearance.

The language, initially started by the JetBrains team back in
July 2011, appears to be focusing on one key advantage – its
ability to compile to Javascript, as well as Java byte code.
Finally there’s IDE Javascript support for Kotlin, which it
previously lacked in the first milestone as you could
only play with Kotlin directly in your browser
with 
Kotlin
Web Demo
.

Andrey Breslav, who is the lead for Kotlin, details the steps
needed to try out Kotlin to JS:

When you install
the M2 Candidate build of the IntelliJ IDEA plugin
, follow
these instructions to try out some Kotlin-to-JS compilation:

  • Check out kotlin-js-hello project
    from github
  • Open it as an IntelliJ IDEA project
  • Set it up as a Kotlin-JS
    project
  • Select your favorite
    browser
     and run. The result will open in the browser.
  • Have fun editing the JavaScript file as you like and
    re-running…

Aside from several bug-fixes as previously mentioned, Kotlin now
has four visibility modifiers (private, protected, public,
internal) and you can now pass an array of values to a
vararg-function (see below):

fun printAll(vararg a : String) {
    for (item in a) println(item)
}

fun main(args: Array<String>) {
    printAll("one", "two")
    printAll(*args)
}

Arguably the biggest step forward this time is that Kotlin runs
on Android, thanks to Aleksandro Eterverda. Developers
will need the Android SDK and IntelliJ IDEA’s Android support
(through plugin) to be able to see Kotlin and Android together.
Check out the GitHub
project
and step-by-step guide to work out how to configure it
all and see Kotlin working on Android.  Work has begun to port
Android samples to Kotlin and we expect to see further advances for
this Android functionality in the near future.

To get Kotlin M2, check out the
release announcement
to find out more. As ever, feedback on
Kotlin is appreciated by the team so get playing with the language,
to see what it can do. Kotlin is looking good, but what comes next
might set it apart from the plethora of JVM languages.

Author
Comments
comments powered by Disqus