The Parallel Universe Blog

May 29, 2015

Quasar/Pulsar 0.7.0 Released: Kotlin and more Clojure

By Ron

A new Quasar/Pulsar release has just landed, packed with lots of new features and improvements: initial Kotlin M12 support with a preview of a Kotlin Actors API, Clojure automatic instrumentation, an upgraded core.async implementation (v0.1.346.0) and performance enhancements.

Quasar 0.7.0: Kotlin M12 language support and Kotlin Actors preview

Kotlin is JetBrains’ fun, statically-typed, safe, interoperable and expressive language targeting the JVM, Android and JavaScript, and it has just reached its M12 release. We are very happy to announce that Quasar 0.7.0 introduces support for Kotlin.

We have worked with the Kotlin team on making Quasar on Kotlin smooth, natural and fast. To get just a small taste of what the Quasar API looks in Kotlin, here’s an example of an actor doing selective receive, using Kotlin’s advanced syntax features (this snippet employs inline functions, lambdas, and a type-safe matching when expression):

class Pong() : Actor() {
    Suspendable override fun doRun() {
        while (true) {
            receive(1000, TimeUnit.MILLISECONDS) {  // Fiber-blocking
                when (it) {
                    is Msg -> {
                        if (it.txt == "ping")
                            it.from.send("pong")    // Fiber-blocking
                    }
                    "finished" -> {
                        println("Pong received 'finished', exiting")
                        return                      // Non-local return, exit actor
                    }
                    is Timeout -> {
                        println("Pong timeout in 'receive', exiting")
                        return                      // Non-local return, exit actor
                    }
                    else -> defer()                 // don't handle message now
                }
            }
        }
    }
}

More info is available in the docs, and we’ll be following with a blog post on Quasar in Kotlin soon.

Pulsar 0.7.0: automatic instrumentation for Clojure code and upgraded core.async implementation

Pulsar 0.7.0 introduces automatic instrumentation for Clojure code so you don’t need those suspendable!, defsfn and sfn (enabling this feature carries a small performance penalty). More information is available here.

In addition, Pulsar’s fiber-enabled high-performance core.async implementation has been upgraded to version 0.1.346.0 and includes transducers support as well as an efficient implementation of core.async’s new ops.

…And more

The new release also brings finite-state-machine actors, improves performances, offers additional channel transforming ports, additional Java 8-specific APIs as well as an unified StrandFactory API. It also includes several smaller API improvements and it fixes several issues.

Next Up: Android

It didn’t make the cut for 0.7.0, but Android support is next on our major feature list.

Enjoy!

Join our mailing list

Sign up to receive news and updates.

Tags: ,

comments powered by Disqus