In a couple of days Ceylon 1.2 will be released. Ceylon 1.2 is
out now, after a year of development. That’s exciting for us,
but we think it would be interesting to summarize our thoughts about why you should be excited
about Ceylon, and why you might consider it over other programming languages designed to run on the
Ceylon is a rather ambitious programming language, so sometimes when people ask us to summarize
its advantages, it can be a bit difficult to know where to start!
A truly cross-platform language
implementation of a compiler backend for the Dart VM is already quite advanced, and work has begun
on a native backend based on LLVM. The architecture of the compiler and tooling make addition of a
new runtime environment, if not easy, at least straightforward.
Also important: Ceylon is rigorously defined by a complete language specification. The very act
of writing a specification forces the language designer to really think through the semantics and
corner cases, and acts as an essential reference as to what the behavior of the compiler
doesn’t feature JVM-specific numeric types with semantics that aren’t relevant to—or can’t be
honored on—other VMs. And its language module isn’t polluted with dependencies to types like
java.lang.Exception that don’t exist in other runtime environments. Instead, Ceylon’s language
module completely abstracts the underlying runtime, and offers a set of elegant APIs that vastly
improve on those available natively.
But this abstraction doesn’t come at the cost of lowest-common-denominator performance
characteristics. On the contrary, you can expect Java-like performance when Ceylon executes on the
Nor does this abstraction limit the potential for interoperation with native code. Ceylon features
excellent interoperation with Java and Maven, and it’s very easy to use most Java libraries in
Ceylon. Similarly, Ceylon’s battery of
dynamic constructs make interoperation with native
native functions and classes in Ceylon 1.2, it’s even
Finally, Ceylon's module system is already compatible with OSGi, with Maven, with Vert.x, with
requirejs. When Jigsaw finally arrives, we'll support it too.
This all amounts to an impressive engineering achievement, especially when taking into account the
sophistication of the language itself.
Truly disciplined static typing
Chances are you have some experience writing code in a language with static typing. In combination
with the right tooling, static typing makes code more robust, more understandable, and much more
maintainable. But most languages go out of their way to include features and APIs which undermine
their own static type system. A handful of languages such as ML and Haskell eschew this, offering
a principled, disciplined approach to static typing. And programmers working with these languages
report a curious thing: that their programs have a strange tendency to work first or second time
they run them. Sure, it takes a little longer to produce a program that the compiler accepts, but
once the compiler is satisfied, so many common bugs have already been eliminated, that the program
is often already correct or at least almost correct.
Ceylon follows this same philosophy and, even though it’s a very different sort of language to ML,
our experience is that our programs have the very same tendency to just work, almost immediately.
You surely won’t believe this until you experience it yourself.
Ceylon’s type system itself is state-of-the-art, including generic types with both use-site and
declaration-site covariance and contravariance, mixin (multiple) inheritance, principal instantiation
inheritance, sum types, disjointness analysis, experimental support for higer-order and higher-rank
generics, and, best of all, union and intersection types.
Union and intersection types
Ceylon was the first modern language to introduce a full implementation of union and intersection
types, and the first language to realize that union and intersection types make flow-typing and type
inference, especially generic type inference, very much simpler, more predictable, and more elegant.
As of today, it’s still the language with the most sophisticated support for unions and intersections.
What’s most difficult to explain to folks who’ve never written any significant amount of code in
Ceylon is just how powerful union and intersection types really are. Far from being an exotic
construct that you encounter occasionally in tricky library code, they form an essential part of the
everyday experience of writing code in Ceylon, and there is almost no significant Ceylon program
which doesn’t use union types somewhere. It’s no exaggeration to say they will totally change the
way you think about types.
Ceylon was also the first modern language to embrace the notion of flow-sensitive typing, where the
conditional logic in the body of a function affects the types inferred by the compiler. This approach
eliminates a significant amount of verbosity and a significant number of runtime type casting errors.
In combination with Ceylon’s powerful coverage and disjointness analysis, it also helps detect
certain other kinds of logic errors.
The cleanest solution to the problem of null
null value has perplexed language designers for decades. For a long time the “best” solution
to the problem was an ML- or Haskell-style
Maybe type, which offered type safety and eliminated
the hated “null pointer” error. That solution works quite well for languages without subtyping, but
it’s not the best approach for a language with subtyping and union types. Ceylon’s approach to
is just as type safe, but, with flow-sensitive typing, is more user-friendly, and it doesn’t require
the overhead of separate
Option-style wrapper objects. Unlike some other languages,
Null isn’t a
special case in Ceylon’s type system. Rather, it’s just one further example of the power of union
An elegant and powerful representation of tuple and function types
Like most other modern languages, Ceylon features tuples and function references. Unlike other
languages Ceylon doesn’t represent these things as special cases in the type system, nor as an
explosion of interface types, one for each tuple/function -arity. Instead, there is just one class
Tuple, and one interface
Callable which expresses function types in terms of tuple types. This
approach allows the language to abstract over tuple or function -arity, and write higher-order
functions that simply can’t be expressed in many other modern languages.
Along with Gosu, Ceylon is one of only two languages to offer reified generics on the JVM. And it’s
into attempts to “backsplain” the lack of reified generics in Java or other JVM languages: claims
that reified generics perform badly, aren’t useful, or don’t work correctly with variance or with
higher-order generics. Ceylon is an existence proof that none of these assertions is true.
The system of reified generics backs Ceylon's unique typesafe metamodel, which enables powerful
runtime metaprogramming (reflection). It also makes debugging easier: you can see the runtime
type arguments of every generic type or generic function in the Ceylon debugger!
A clean, efficient, highly readable syntax
A program written in idiomatic Ceylon is usually much more compact than the same program written
in Java. But it’s also usually more readable. Ceylon’s syntax appears, at first glance, to be rather
boring and conservative: it uses familiar (and cleaner) prefix type annotations instead of postfix
types; it uses plain English keywords instead of cryptic strings of symbols; its naming convention
eschews the use of abbreviations. When you look at a program written in Ceylon, you’ll probably
understand more or less what it’s doing, even if you have only a passing familiarity with the
But that first impression misses a surprising amount of syntactic flexibility. Type inference, named
arguments, comprehensions, tuples and sequences, “fat arrow” function definitions, anonymous
object expressions, flow-sensitive typing, and a
very powerful facility for stream processing all work together to lend a level of expressiveness
rarely seen outside of dynamic languages.
Operator overloading is a feature that, while useful, is widely abused in languages that offer it in
unadulterated form. Instead of untrammelled operator overloading, Ceylon supports operator
polymorphism, a more disciplined approach, where its operators have fixed, well-defined semantics,
but are defined in terms of interfaces that user-written types may satisfy. Thus, you can have the
+ operator apply to your own class, but it always means some kind of addition-like operation.
We often don’t need to write down the types of things explicitly (type inference takes care of that),
but when we do, Ceylon features a uniquely sophisticated expression syntax for types, along with
type aliases, eliminating the verbosity of generic type declarations in other languages.
Ceylon’s suite of command line tools, including an incremental compiler, program runner, test runner,
documentation compiler, code formatter, and WAR archive packager, are all accessible via the
command, which features a plugin architecture, and excellent usability.
But Ceylon really comes into its own when authoring code using its powerful Eclipse-based IDE.
Ceylon’s IDE has a feature set that easily surpasses other modern languages, and competes with much
more mature languages like Java and C#. For those who prefer IntelliJ, an IntelliJ-based IDE is
already in the works, with a first release planned in the next few months.
If you’ve ever spent time waiting for
mvn to finish, you’ll immediately appreciate Ceylon’s
powerful module architecture, which comes fully integrated into the command line tools and IDE.
Modularity is a problem that is utterly central to the discipline of software engineering, and
Ceylon, at least arguably, does it better than any other language out there. You don’t usually need
to interact directly with the module repository architecture, since the command line compiler, IDE,
and runtime all know how to fetch dependencies transparently.
Finally, Ceylon Herd is an fantastic tool that makes it ridiculously easy to share your work
with other Ceylon developers.
Seamless web development
Ceylon is evolving into a compelling platform for web development, allowing you to reuse code
cleanly with native code on both sides. With our new serialization facility, you'll be able to
transparently move objects between client and server. The Ceylon SDK comes with a HTTP server
module based on Undertow, and a transactions module based on JBoss Transactions, but if you're
looking for something "heavier", Ceylon modules can already be deployed on RedHat's OpenShift
cloud platform, on WildFly, or on Vert.x 2 (with Vert.x 3 support coming soon). Alternatively
you could use Ceylon in Node.js!
Developing web applications in Ceylon is actually enjoyable. With Ceylon, you'll spend much less
time redeploying and/or refreshing things, or wrestling with inadequate tooling, and more time
focused on writing elegant code.
A helpful and open-minded community
If you're motivated to contribute, there's plenty of places to get involved. Some fairly significant
parts of the Ceylon ecosystem were originally written by community contributors. Currently, the
development of two new compiler backends is being driven by the community. Note that a whole lot of
development, including the IntelliJ IDE, and the new compiler backends, is now being done in Ceylon,
so you can learn Ceylon by contributing to the Ceylon project itself!