FunctionSource, Your Source for Developer News

Java.embiggen(): CoffeeScript is to JavaScript as Loop is to Java?

Posted by Dion Almaer 11 months ago on java loop

Dhanji R. Prasanna is an amazing hacker to follow. In his past was Wave, but currently he is working on a fantastic Web based email client (feels like a more stream based Sparrow) Fluent with other awesome chaps.

He also just released a nice little language called loop. It feels like a modern Groovy. As you read through the docs you find yourself nodding your head. It just kinda makes sense. This is partly because it cleans up a lot of the warts of Java along the way (as did Groovy).

This is similar to CoffeeScript. It cleans up JavaScript without trying to do TOO much more. It is always tempting to add a bit of this and that, and you often end up with too much.

One area Loop does delve into is concurrency. This is important as in this day and age if you aren’t ready for that problem, then why both. One key feature is channels:

You may be familiar with message-passing as a framework for coordination between multiple concurrent processes. Many languages and libraries provide something like this. The theory is that if concurrent processes only ever communicate by sending messages to each other, then there is no shared mutable state, and limited potential for memory corruption, deadlocks and starvation.

Channels are an abstraction over message passing and thread pools that allows you to work in terms of events and event handling functions. A channel consists of an event queue and a handler function, backed by a pool of threads.

This builds on another great new feature, pattern matching (from the functional world [i.e. Haskell]).

Compare this to Scala, which in my humble opinion tries to do too much, and you end up with a C++ situation where you can actually be in good shape if you agree on what features you are going to use.

Since loop sits on top of the JVM you will have the usual issue of people thinking that is great (performance tuned, well known tools, deep library set, etc) or awful (JVM can be a pain to work with, slow startup (if you want to use this for scripting), too much Java-ness gets into your code, need to know the Java platform in depth, etc).

Nice work Dhanji, on both loop and Fluent!