Red Hat engineer Gavin King, the creator of Hibernate, is developing a new programming language for enterprise software development. His team at Red Hat has apparently been working on the grammar in secrecy for two years and is finally opening it up for scrutiny.

The new language, which is called Ceylon, is intended to remedy what King views as fundamental shortcomings of the Java programming language. It's more succinct and expressive but is designed to be easy to read and learn. It will run on existing Java virtual machines and draws on many of Java strengths while addressing some key limitations.

Ceylon was introduced at a conference in Beijing this month as an early preview. King's conference slides, which are available for download from his website, offer a glimpse into the rationale behind the language and some of its syntactic characteristics. Although the slides give a good sense of Ceylon's flavor, there are still a lot of specific details that aren't available yet.

Syntax

The language is statically typed, supports first-class functions, and emphasizes a conventional object-oriented style of development. It has a typical C-like syntax and is largely designed to appeal to existing Java programmers. Despite its strong roots in Java culture, it offers a few highly controversial deviations from Java orthodoxy.

Its approach to managing encapsulation is much simpler than conventional Java, eschewing the standard public/private/protected designations in favor of a "shared" annotation that is used to signify methods or values that can be accessed externally. It doesn't allow function overloading via type signature, but supports variadic functions with named parameters. There are no constructors for classes—the initialization logic gets plopped straight in the class body.

One of the more intriguing aspects of Ceylon is that its syntax for passing optional named parameter values into methods lends itself well to creating declarative domain-specific languages. The following code example from King's slides, which is written with Ceylon's native syntax, is particularly illustrative:

Table squares { title = "Squares"; rows = 10; Column { heading = "x"; String content(Natural row) { return $row; } } Column { heading = "x**2"; String content(Natural row) { return $row**2; } } }

King contends that intrinsic support for creating such expressive declarative structures in code will reduce the Java community's dependence on XML for tasks like creating user interface layouts. In addition to the major syntactic differences, the Ceylon project will also aim to produce better class libraries and a better SDK than what developers get today with Java SE.

Rationale

There is no question that the Java programming language is starting to look a bit dated compared to more modern and faster-evolving alternatives like C#, but that's not necessarily a problem for real-world Java developers. There are plenty of compelling languages that run on the JVM and offer a more expressive syntax than conventional Java—some examples that are worth noting include Scala, Groovy (our sister site Wired uses quite a bit of Groovy under the hood), Clojure, JRuby, and Noop.

King and his team of Red Hat engineers have invested two years of effort on Ceylon, but the obvious and inescapable question is why they would bother creating a whole new language rather than adopting and contributing to one of the existing languages. Scala, in particular, seems like a worthy candidate for Red Hat to adopt. It has a loyal following, it is licensed under permissive open source terms, it is conducive to augmentation, and it has a proven track record in large-scale Web applications.

One of the chief goals behind Ceylon is to create a language that will be easy to learn and easy for existing Java programmers to adopt. King seems to believe that a functional programming language would have difficulty meeting those goals. It also seems like a matter of strong personal preference for King—his slides include a rather trollish dismissal of programming languages that are based on "the lambda calculus used only by theoretical computer scientists."

He offered further clarification, addressing Scala specifically, in a comment that he posted on his blog:

We looked closely at Scala, but we collectively concluded that it wasn't the right thing for us. Personally, I find that Scala's type system is simply more complex than I want or need, with several features I think actually harm understandability/readability, and I find its syntax a bit of a dog's breakfast. We're trying to live with a lot less language features than Scala. Leaving stuff out is, in and of itself, often a Good Thing. And we think it's important to have a very regular, visually pleasing, readable syntax.

Putting aside philosophical ruminations about what makes a programming language visually appealing, it's not hard to explain why a language that looks more like Java will offer an easier path of assimilation for existing Java programmers. On that level, he's certainly got it right. Whether Ceylon is actually able to attract a more mainstream following in practice is something we will obviously have to wait to see.

Not a Java-killer

When Ceylon first started receiving attention among Java bloggers and the press following King's presentation, it was erroneously perceived as an effort to replace Java. King has attempted to clear up the misunderstanding by explaining that it's merely intended as an alternative, much like the existing third-party JVM languages.

King says that Red Hat is advancing the project with the hope of supplying a mainstream programming language that will ameliorate common frustrations with Java, but he indicated that the company doesn't plan to push for Java to be deprecated and replaced wholesale.

Red Hat got into the Java middleware business with its 2006 acquisition of JBoss. It's not surprising that Red Hat wants a more modern JVM-targeted language that will better meet developer requirements and potentially offer more productivity to JBoss adopters. VMware-owned SpringSource, a competing Java middleware vendor, similarly backs the Groovy language and associated Grails framework.

There are some major ongoing disputes between various Java stakeholders regarding JCP governance issues and control of the language. It's tempting to speculate about the potential for independent forks and such, but that is not at all what Ceylon is about. It's still fundamentally a JVM-based language and is designed to interoperate with the rest of the existing Java ecosystem.

Red Hat, much like IBM, has already elected to stand behind Oracle's stewardship of the Java platform in order to avoid fragmentation. Red Hat is obviously frustrated to some extent with the slow pace of Java's evolution and some of the long-standing technical limitations. Ceylon is a way to bypass the bureaucracy and give developers the option of moving forward, but it's not a power play to displace Oracle's control over Java.

Current status

Ceylon is still at a pretty early stage of development. King says that the work completed so far largely consists of a language specification and an ANTLR grammar. He acknowledges that building a working compiler and SDK will require a great deal of effort, but says that "it's not an enormous undertaking for a company of Red Hat's size." King also indicated that community collaboration is a high priority for the project.

Red Hat is enjoying a lot of growth and profitability right now. The company certainly has the resources to build its own programming language and make it a success. Although the move seems a bit eccentric in light of the broad availability of existing alternative languages, King makes a decent case for Ceylon and its potential benefits.