Justin du Coeur (jducoeur) wrote,
Justin du Coeur
jducoeur

Language of the Week: Ceylon

Thanks to laurion for pointing me to this Ars Technica article about Ceylon. This is a new language proposed by some of the folks at Red Hat, and is interesting enough to be worth a look. In particular, the links to the conference slides early in the article are quite useful: it's two modest slide decks that outline the major concepts of the language. Since the Ars article explicitly raises comparisons with Scala (another next-gen JVM language), I'll do so as well.

At a quick look, my response is, "Not bad". It is trying to provide an alternative to Java -- not a full-scale replacement, but another JVM language that is good for many use cases. I'd say that they succeed in producing something better than Java in a number of respects: the language is cleaner and more powerful than Java, and not too hard to use.

On the downside, they have a somewhat prissy dislike of lambdas, and their drumbeat of "Simple! Simple! Simple!" -- which is their argument against Scala -- has consequences that they don't acknowledge. Specifically, Scala is almost fanatical about reducing boilerplate code, so that your program says exactly what it means. Some of the deliberate decisions in Ceylon mean that it clearly doesn't go nearly as far, although it's certainly a great improvement over Java. In general, I don't think it's ever going to be as good for functional designs as Scala is, but it's a fairly pragmatic set of compromises. Broadly speaking, it doesn't adopt Scala's focus on making everything as consistent as possible, but it does have some steps in the right direction.

It adds some excellent features (eg, proper first-class functions), and its definition of "interface" seems to be similar to what Scala calls a "trait" -- a very powerful feature and a big win. It does have interface unions, which Scala does *not* yet have -- I'll be interested to see how well that works in practice. (Scala doesn't have union types yet because working out all the edge cases is a tad tricky.) In general, it is less powerful than Scala's traits, but better than most languages.

It chooses to eschew the usual complexities of "protected" vs. "private" with a simple "shared" keyword -- in this case, I might well agree that that's a good simplification. It has a clever syntax for type narrowing that is safer and more concise than most approaches I've seen. Its reified generics are arguably clearer than Scala's manifests. (Both are dealing with the usual problem of erasure of generic types.) Its use of "in" and "out" to represent covariance and contravariance is probably clearer than Scala's "+" and "-". By and large, they tend to favor words over symbols, and the choices of keywords generally make the code more readable.

Overall, it looks like a reasonable set of compromises. It's missing a lot of the power of Scala, and isn't going to change my assessment of the latter as the current best language, but this makes some good choices about what language improvements provide the biggest bang for the buck. If the world broadly started using Ceylon instead of Java, that would probably be nothing but an improvement...
Tags: programming
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments