A Q&A with Gavin King on Ceylon
A Q&A with Gavin King on Ceylon
The JVM language Ceylon's creator, Gavin King, has some interesting tales about the project's origin and future. He's also the creator of Hibernate, if you didn't know.
Join the DZone community and get the full member experience.Join For Free
Secure your Java app or API service quickly and easily with Okta's user authentication and authorization libraries. Developer accounts are free forever. Try Okta Instead.
Ceylon 1.2 has just been released, and in this Q&A the Ceylon project leader Gavin King provides some insights into where Ceylon originated, what is can do for you today, and where the project is going next.
What was the inspiration for the development of Ceylon?
The very original inspiration was, a few years ago, seeing people —friends— abandoning Java for languages like Ruby and Python, complaining about its lack of expressiveness. I remember thinking that this was a mistake, and that Java, whatever flaws it had or has, offered compelling advantages over dynamic languages if what you were trying to do was produce code that was maintainable by a team of people over a period of years. And I resisted the notion of giving up the fantastic modern tooling we had and still have for Java, and going back to the sort of tools that I used to program with when I was a teenager. But the criticisms of Java that were made by the advocates of dynamic languages stuck with me, so I started to ask myself how we could have the best of both words: disciplined static typing, maintainability, tooling, but also expressiveness and all-round high productivity.
Before actually beginning work on the project, we took a look at some of the other languages out there, and, while some of them are nice languages, none of them really offered all the things we actually like about Java.
How do you see Ceylon positioned with respect to other JVM based languages?
Now, this sort of abstraction introduces many technical challenges, since we don’t want it to come at the cost of performance or of interoperability with native code and native libraries for those
Second, Ceylon offers a rather nice combination of a disciplined, elegant, totally state-of-the-art static type system, in a language that is also extremely readable and easy to understand for newcomers. Ceylon’s unique type system is founded on two new, key things: union and intersection types, and flow-sensitive typing. The way we’ve put these ideas together means that we can have a stronger and more expressive type system, but one that is also easier for programmers to reason about.
Unlike every other language for the JVM, Ceylon has fully-reified generics, and you can see the runtime type arguments in the debugger, or reflect on them at runtime.
Third, Ceylon comes with modularity built in. We never deal directly with class files and classpaths in Ceylon. Instead, the notion of a module is built into the language, and all the tooling (both the IDE and the command-line tools) know how to communicate directly with module repositories and manage dependencies and publish compiled modules.
Finally, Ceylon has an awesome, totally full-featured, Eclipse-based IDE. When we say this, I don’t think people actually believe it, since they’re so used to the notion that any new language is going to suffer from limited tooling support. That’s not the case with Ceylon, and it really fundamentally sets Ceylon apart from other new languages out there.
Can you give some examples of things that Ceylon’s type system can do?
A simple example is: if I have a list of `Planet`s, and I append a`Star` to it, what should be the type of the resulting list? This is a problem that most languages have problems with, because they can’t assign a unique type to the list, and so the programmer must be explicit to resolve the ambiguity. In Ceylon, there is a unique, best, inferable answer: it is a List<Star|Planet>, and the compiler can infer that all by itself.
A second simple example is: suppose I’m writing a generic function that removes null values from a list. The only trick is: it could be a list of anything at all! All I have is some unknown element type E. What should the return type of the function be? Well, in Ceylon, the function would accept a List<E> and return a List<E&Object>. Now, when that function is passed a list with Strings an nulls in it—which is a List<String|Null> in Ceylon—the compiler is capable of automatically
simplifying the return type List<<String|Null> & Object> to List<String> using very simple, intuitive, algebraic rules that I can teach you in five minutes.
What do developers have to look forward to with the release of Ceylon 1.2?
Being an even-numbered release, 1.2 introduced a several new language
support for cross-platform serialization libraries,
“native” declarations for cross-platform modules,
improvements to flow-sensitive typing,
destructuring for tuple types,
“let”, “switch”, “if”, and “object” expressions
But of course after a year in development there’s virtually no part of Ceylon which hasn’t been improved. For example, the IDE now has a brand new debugger, there is a new tool for epackaging a Ceylon module as a Java EE WAR archive, the tools now interoperate much better with Maven, and there are many improvements to the language module and SDK.
What are you planning to work on next?
Right now our top priorities are productization of Ceylon on the Android platform, and to finish the work in progress to make Ceylon IDE work on IntelliJ. With respect to Android support, Google kind of pulled the rug out from underneath us by abandoning Eclipse for IntelliJ at a time when we were already building integration with the Android plugin for Eclipse. But with the new IntelliJ plugin, we’re back on track to deliver convincing Android support.
What has the community reaction been like to Ceylon?
Well, with the release of 1.2, the reaction has very much been “OK, you’ve finally convinced us, so this looks great technically, and we want to use it, but you guys suck at marketing, so what are you going to do to promote it better?”
And so, fair enough, we’ve taken that on board, and I promise that this is going to change. We’ve been so deep in the weeds writing code and arguing over design that until now there weren’t even any example applications or demos or anything like that. Hell, I even just created
a Twitter account (http://twitter.com/1ovthafew) for myself! ;-)
Is there an elevator pitch for Ceylon you could give to an existing Java developer?
Sure, so the pitch is: here’s a language that has almost everything you like about Java, without a number of things that are broken in Java, but that is significantly more powerful, more expressive,
letting you raise the level of abstraction of your code when necessary, and that you can also use on the client side.
Do you have any favorite books, presentations, tutorials or blog posts on the topic of Ceylon?
I wrote down my thoughts on why someone might choose Ceylon as their
next programming language here:
There is a cute demo of Ceylon running on the client side here:
Here on dzone, Akber Choudhry shared his excitement about Ceylon:
Tom Bentley and Stef Epardaud recently presented Ceylon to the Virtual JBUG:
We also welcome anyone who’s interested in Ceylon to join us on Gitter:
Opinions expressed by DZone contributors are their own.