ArticleslgStudy

computer science

Ceylon (programming language)

Ceylon (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Ceylon (programming language) rather than just read about it. In short: Ceylon was an object-oriented, strongly statically typed programming language with an emphasis on immutability, created by Red Hat. Ceylon programs run on the Java virtual machine (JVM), and could be compiled to JavaScript.

Ceylon (programming language) — main illustration
Ceylon (programming language) — illustration

Key takeaways

  • Ceylon (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Ceylon (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Ceylon (programming language) from memory before moving on to harder problems.

Reference excerpt

Ceylon was an object-oriented, strongly statically typed programming language with an emphasis on immutability, created by Red Hat. Ceylon programs run on the Java virtual machine (JVM), and could be compiled to JavaScript. The language design focuses on source code readability, predictability, toolability, modularity, and metaprogrammability. Important features of Ceylon include:

A type system enforcing null safety and list element existence at compile time Regular syntax and semantics, avoiding special cases and primitively defined constructs in favor of syntactic sugar Support for generic programming and metaprogramming, with reified generics Modularity built into the language, based on JBoss modules, interoperable with OSGi and Maven powerful tools, including an Eclipse-based IDE The name "Ceylon" is an oblique reference to Java, in that Java and Sri Lanka, formerly known as Ceylon, are islands known for growth and export of coffee and tea. In August 2017, Ceylon was donated to the Eclipse Foundation. Development slowed down and finally stopped in 2020. In April 2023, Eclipse Foundation declared the termination of the transition.

Language features Ceylon is heavily influenced by Java's syntax, but adds many new features.

Type system One of the most novel aspects of Ceylon compared to Java is its type system. Ceylon omits Java's primitive data types and boxing in favor of a type system composed of first-class objects only. This makes the type system more uniform, but can cause boxing overhead in some situations. Ceylon allows for union and intersection types, in a similar way to TypeScript, Whiley, and FLOW, which copied the idea from Ceylon. Union types, written A|B, allow a variable to have more than one type. The following example shows a Ceylon function which may take either an integer or a string:

Intersection types, written A&B, are the theoretical foundation of flow-sensitive typing:

The condition is Integer input narrows the type of input to <Integer|String> & Integer, which distributes to Integer&Integer | String&Integer, which, as String and Integer are disjoint types, is equivalent to Integer&Integer | Nothing (Nothing is the empty bottom type), which simplifies to just Integer.

Null safety Union and intersection types are used to provide null safety. The top type of the Ceylon type hierarchy is the class Anything, which has two subclasses: Object, the superclass of all normal classes and all interfaces, and Null, with the only instance null. Since Object and Null are disjoint types, most regular types like Integer or List<String> are not nullable; a nullable type is the union Integer|Null, abbreviated Integer?. Intersection types can be used to get a non-optional type out of a possibly-optional type, such as a type parameter. For example, the signature of a function that removes null elements from a stream of values could be:

When removeNulls is called with a stream of Integer|Null elements, the result will be a stream of <Integer|Null> & Object elements, which simplifies to Integer.

Functions Similarly to many modern languages, Ceylon supports first class functions and higher order functions, including function types and anonymous functions

Enumerated types Similar to Java and many other languages, and with a similar mechanism as algebraic types, Ceylon supports enumerated types, otherwise known as enums. This is implemented in Ceylon with a pattern of limiting the instances of an abstract class at declaration to a limited set of objects (in this case, singleton instances). Another way to implement this pattern is with the new constructor feature in Ceylon 1.2 where the objects are implemented as different named constructor declarations.

Type inference Ceylon is strongly and statically typed, but also has support for type inference. The value keyword is used to infer the type of a variable, and the function keyword is used to infer the type of a function. The following two definition pairs are each equivalent:

However, to make single-pass type inference possible, type inference is only allowed for non-toplevel and unshared declarations.

Entry point with names By default the starter (ceylon run) runs the shared run() function of a module:

but any other shared function without parameters can be used as main calling the program with the run parameter, like this: ceylon run --compile=force --run hello default

Versions Versions of Ceylon released:

M1 0.1 "Newton" (Dec 20 2011) M2 0.2 "Minitel" (Mar 2 2012) M3 0.3 "V2000" (Jun 21 2012) M3.1 0.3.1 "V2000" (Jul 6 2012) M4 0.4 "Analytical Engine" (Oct 29 2012) M5 0.5 "Nesa Pong" (Mar 13 2013) M6 0.6 "Virtual Boy" (Sep 23 2013) 1.0 beta "Virtual Boy" (Sep 24 2013) 1.0.0 "No More Mr Nice Guy" (Nov 13 2013) 1.1.0 "Ultimate Ship The Second" (Oct 09 2014) 1.2.0 "A Series of Unlikely Explanations" (Oct 28 2015) 1.2.1 "Irregular Apocalypse" (Feb 11 2016) 1.2.2 "Charming But Irrational" (Mar 11 2016) 1.3.0 "Total Internal Reflection" (Sep 19 2016) 1.3.1 "Now We Try It My Way" (Nov 22 2016) 1.3.2 "Smile Tolerantly" (Mar 02 2017) 1.3.3 "Contents May Differ" (Aug 21 2017)

License All parts of Ceylon are available as free software, mostly the Apache License. Part of the source code is licensed under LGPL.

See also

Dart (programming language), has its own VM, compiles to JS, type system not very strict, supports mixins Fantom (programming language), compiles to JVM, type system not very strict, supports mixins

References

External links Official website

Worked examples

Example 1 — a first encounter with Ceylon (programming language)

Start with the simplest possible case. Write down what Ceylon (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Ceylon (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Ceylon (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Ceylon (programming language)

In research
Ceylon (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Ceylon (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Ceylon (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2011 software, High-level programming languages, JVM programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for Ceylon (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Ceylon (programming language)” →

How to study Ceylon (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Ceylon (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Ceylon (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Ceylon (programming language) in simple terms?

Ceylon was an object-oriented, strongly statically typed programming language with an emphasis on immutability, created by Red Hat. Ceylon programs run on the Java virtual machine (JVM), and could be compiled to JavaScript.

Why does Ceylon (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Ceylon (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Ceylon (programming language).

Tags

  • 2011 software
  • High-level programming languages
  • JVM programming languages
  • Java programming language family
  • Programming languages created in 2011
  • Red Hat software
  • Software using the Apache license
  • Source-to-source compilers

Keep exploring