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
2
votes
3 answers

Initialising Sequential values with for loop?

Is there any way to initialize a Sequential value not in one fellow swoop? Like, can I declare it, then use a for loop to populate it, step by step? As this could all happen inside a class body, the true immutability of the Sequential value could…
user134055
2
votes
1 answer

Trouble implementing Summable

I'm trying to implement classes DistanceCM and DistanceMM, and I want these to be summable interchangeably, as long as they both inherit from Distance. However, I get this error: "Error:(46, 76) ceylon: type parameter 'Other' of declaration …
user134055
2
votes
1 answer

Ceylon modules in different versions?

I'm trying to make a simple app that utilizes the ceylon.http.server, ceylon.json, ceylon.io modules. When I compile, I get these errors: Error:(4, 8) ceylon: source code imports two different versions of module…
user134055
2
votes
1 answer

In ceylon, how do I get Class object from a class?

I have a method that takes a java.lang.Class object as a parameter. How do I get that from a Ceylon class? That is, the equivalent of SomeClass.class in Java.
Tomas Hofman
  • 138
  • 1
  • 4
2
votes
1 answer

Error compiling Ceylon example with Gradle

Ceylon 1.3.1 has just been released, one of the new items is better integration with Java projects/libraries. Decided to take one of the samples for a spin (https://github.com/DiegoCoronel/ceylon-spring-boot) alongside the ceylon-gradle plugin…
Andres Almiray
  • 3,236
  • 18
  • 28
2
votes
1 answer

Running the ceylon typechecker from ceylon, like in typechecker/src/main/Main.java

I'm running the ceylon typechecker from a ceylon project with a run.ceylon which is exactly a ceylon version of typechecker/src/main/Main.java. This project is supposed to typecheck itself. It compiles without errors, but at runtime cannot load…
user3464741
2
votes
1 answer

Tuple without last element with correct type

Is it possible to remove the last element from a tuple in typesafe manner for arbitrary arity? I want something like this: [A,B,C] abc = [a,b,c]; [A,B] ab = removeLast(abc);
guai
  • 780
  • 1
  • 12
  • 29
2
votes
1 answer

Mapping between Java's wrapper classes and Ceylon basic types

When a ceylon module imports "java.base" "8" it doesn't see the original java.lang classes, but it gets something else. So when I want a parsing from a java string to a java integer I have to cast java string to ceylon string and then parse it into…
user3464741
2
votes
2 answers

Working with ceylon import-jar

How can I import a library from maven central into a project with the ceylon import-jar command? Please show the full command. E.g. for "joda-time-2.9.4.jar" from "http://repo.maven.apache.org/maven2/" into a local directory. I guess it must…
user3464741
2
votes
1 answer

How to feed ancompilation unit obtained from ceylon.ast to the Ceylon compiler?

The following example found in the ceylon/ceylon.ast project shows how to construct some AST programmatically and have it typechecked by the Ceylon typechecker…
user3464741
2
votes
2 answers

How to apply the 'maven:' prefix in a ceylon module descriptor

My module descriptor looks like that: native("jvm")module mod "1.0.0" { import "joda-time:joda-time" "2.9.4"; } I can successfully compile and fat-jar it with ceylon 1.2.3. But the compiler warns about prefixing it with…
user3464741
2
votes
3 answers

Updating an immutable sequence

I have a sequence in Ceylon and I want to make a new sequence with one of the elements replaced with something else according an index: [String*] strings = ["zero", "one", "two"]; value index = 1; value newElement= "uno"; [String*]? newStrings =…
drhagen
  • 8,331
  • 8
  • 53
  • 82
2
votes
2 answers

Is there an equivalent to scala's monadic-for/yield syntax in ceylon?

How can one achieve a ¨monadic for/yield¨ syntax in Ceylon, e.g. for trampolining, since Ceylon does not perform tail call optimization. The for/yield-syntax requires the introduction of new variable names which is not possible using Tree-like…
user3464741
2
votes
2 answers

How to use ceylon js (also with google closure compiler)

Calling a file resulting from the concatenation (bash: cat ... >> app.js) of the following three files: /usr/share/ceylon/1.2.0/repo/ceylon/language/1.2.0/ceylon.language-1.2.0.js…
user3464741
2
votes
1 answer

Appending to a sequence in Ceylon

How do I append a single element to a list in Ceylon? I tried the append method like this, but it only accepts another list: value list = [1,2].append(3); // Integer is not assignable to 'Nothing[]' Obviously, I can work around by wrapping the…
drhagen
  • 8,331
  • 8
  • 53
  • 82