Questions tagged [ceylon]

Ceylon programming language for Java and JavaScript virtual machines.

Ceylon is a modern, modular, statically typed programming language for Java and JavaScript virtual machines. The language features a flexible and very readable syntax, a unique and uncommonly elegant static type system, a powerful module architecture, and excellent tooling, including awesome Eclipse- and IntelliJ-based IDEs.

The Ceylon language is defined by a readable specification.

Since 'Hello World' is the traditional way to introduce a language, here's how it looks in Ceylon:

shared void hello()
        => print("Hello, World!");

To learn more, you can start with the quick introduction or take the in-depth tour of Ceylon.


Current release: 1.3.3 (Contents May Differ)

  • Ceylon is open source on Github
  • Ceylon 1.4 is under development including migration of the compiler to the Eclipse Foundation.

Ceylon is:

  • Powerful: Ceylon's powerful flow-sensitive static type system catches many bugs while letting you express more, more easily: union and intersection types, tuples, function types, mixin inheritance, enumerated types, and reified generics.
  • Readable: We spend more time reading other people's code than writing our own. Therefore, Ceylon prioritizes readability, via a highly regular syntax, support for treelike structures, and elegant syntax sugar where appropriate.
  • Predictable: Ceylon controls complexity with clarity. The language eschews magical implicit features with ambiguous corner cases. The compiler follows simple, intuitive rules and produces meaningful errors.

Ceylon offers:

  • A platform: Ceylon is a whole platform with amodern SDK designed from scratch. It runs on both Java and JavaScript virtual machines, bridging the gap between client and server. Ceylon is fully interoperable with Java and the Java SDK, and with JavaScript and its libraries.
  • With modularity: Modularity is at the very core of the language, SDK, and tooling. The compiler produces module archives which are then distributed via a next-generation repository architecture with Ceylon Herd as its social focus point.
  • And tooling: Static typing is the technology that enables killer tools. Ceylon comes with a complete command line toolset, and awesome Eclipse- and IntelliJ-based IDEs with searching, refactoring, quick fixes + assists, autocompletion, debugging, and much more.
114 questions
3
votes
2 answers

Incrementing integers

I'm having some trouble incrementing a variable integer. This code: variable Integer myInteger = -1; Integer getInteger () { myInteger = myInteger + 1; print("myInteger: " + myInteger.string); return Integer(myInteger); } Array
user134055
3
votes
1 answer

Ceylon module system: Guava class mismatch even though there's only one Guava in dependencies tree

I'm defining an adapter for JSimpleDB (a persistence library) by subclassing a class that takes a Google Guava Converter as constructor parameter: shared class RoleConverter() extends Converter() { shared actual Role…
Ilmo Euro
  • 4,925
  • 1
  • 27
  • 29
3
votes
2 answers

How do I create an uber jar in Ceylon

I have a Ceylon project. I would like to distribute it in an uber jar that includes all dependencies, so that it can be executed with simple java -jar myproject.jar Is this possible in Ceylon?
user7610
  • 25,267
  • 15
  • 124
  • 150
3
votes
3 answers

Can you alias a tuple type?

I'm playing around with Ceylon and I'm trying to create an alias for a tuple. The following do not work: class MyPair(Integer i, Float f) => [i, f]; class MyPair(Integer i, Float f) => [Integer, Float](i, f); class MyPair(Integer i, Float f) => …
Jeffrey
  • 44,417
  • 8
  • 90
  • 141
3
votes
1 answer

How to get command line arguments in Ceylon?

In a command line Java application you can get arguments through the args parameter: public static void main(String[] args) { How can I do something similar in Ceylon? I tried copying the Java style: shared void run(String[] args) { but got an…
KPD
  • 5,281
  • 4
  • 20
  • 19
3
votes
3 answers

Ceylon equivalent of Collections.shuffle()

Is there a way to "shuffle" up an Iterable (or Sequence), such that elements are subsequently ordered randomly, similar to Java's Collections.shuffle()? I've looked in the API docs for Iterable, Collection, and Sequence, but haven't found anything…
Max
  • 4,882
  • 2
  • 29
  • 43
3
votes
2 answers

How do you flatten a Sequence of Sequences in Ceylon?

Given a type that is a Sequence of Sequences, how do I convert it to a single, flattened Sequence type? Consider the following Ceylon code: Integer[] range(Integer max) { return [ for (idx in 1..max) idx ]; } Integer[] prod(Integer max, Integer…
bdkosher
  • 5,753
  • 2
  • 33
  • 40
3
votes
2 answers

Infinite iterable generator in Ceylon

Is there an easy way in Ceylon to create an infinite iterable which generates each element by calling the same given no-args function? In other words, does the language module offer an equivalent to Java 8's Stream.generate(Supplier)?
gdejohn
  • 7,451
  • 1
  • 33
  • 49
3
votes
2 answers

Iterate enumerated class instances

Is there a simple way to iterate over all enumerated instances of a class in Ceylon? Just like values() for Java enums? abstract class Suit() of hearts | diamonds | clubs | spades { shared formal String name; } object spades extends Suit() {…
Florian Gutmann
  • 2,666
  • 2
  • 20
  • 28
2
votes
1 answer

Can I use Java Core libraries in Ceylon M1 Newton?

I've downloaded the Ceylon SDK and try to play a little bit, but after a while I realize of this: ... SDK At this time, the only module available is the language module ceylon.language, included in the…
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
2
votes
1 answer

How to generate GraalVM native-image for Ceylon?

I tried use --static -jar with Ceylon's compiled fat jar: native-image --static -jar default.jar (default.jar is a fat jar produced by ceylon fat-jar.) But I got an UnsupportedFeatureException saying java.lang.Class.getConstantPool() is not…
weakish
  • 28,682
  • 5
  • 48
  • 60
2
votes
3 answers

Concatenate list of strings

Say I have list of strings in Ceylon. (It does not have to be a List; it could be an iterable, sequence, array, etc.) What is the best way to concatenate all these strings into one string?
drhagen
  • 8,331
  • 8
  • 53
  • 82
2
votes
1 answer

Convert String to UTF-8 bytes

How do I encode a String in Ceylon as UTF-8 bytes? value string = "my_string"; [Byte*] bytes = string.______;
drhagen
  • 8,331
  • 8
  • 53
  • 82
2
votes
2 answers

Ceylon metamodel

I am studying Ceylon and have question about it metamodel. I want to create some create some base class 'DataContainer' which allow to instantiate immutable classes with build-in equals-hash implementation: e.g. Identifier(125, "ab") ==…
2
votes
0 answers

Type of recursively-typed functions in Ceylon

Is there a way to achieve some kind of recursively-typed functions in Ceylon? For example, I can define combinatory logic in Ceylon in a type-safe way like so: class Fi(shared Fi(Fi) o) { } Fi veritas = Fi((Fi t) => Fi((Fi f) => …