Jump to content

Ceylon (programming language): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m de-link
Xan2 (talk | contribs)
m license
Line 12: Line 12:
| file ext = .ceylon
| file ext = .ceylon
| wikibooks =
| wikibooks =
| license = GPL v2
| website = http://ceylon-lang.org/
| website = http://ceylon-lang.org/
}}
}}

Revision as of 21:04, 24 February 2012

Ceylon
ParadigmObject-oriented
Designed byGavin King, Red Hat
First appeared2011 (tentative)
Typing disciplineStatic, strong, safe
LicenseGPL v2
Filename extensions.ceylon
Websitehttp://ceylon-lang.org/
Influenced by
Java, Scala, Smalltalk

The Ceylon Project is an upcoming programming language and SDK, created by Red Hat. It is based on the Java programming language and when it is released, will run under the Java Virtual Machine.[1]

The project is described to be what a language and SDK for business computing would look like if it were designed today, keeping in mind the successes and failures of the Java language and Java SE SDK. The project has been referred to by industry analysts as a "Java killer", though Red Hat themselves reject this term.[2][3]

Language features

Ceylon inherits most of Java's syntax. The following is the Ceylon version of the Hello world program:[4]

void hello() {
   writeLine("Hello World!");
}

Operator polymorphism

Ceylon will not provide operator overloading, as it was deemed to be generally confusing, but instead supports operator polymorphism, where an operator is a shortcut for a method of a built-in type. This is supposed to be safer and simpler than true operator overloading.

Interfaces

Interfaces are data structures that contain member definitions and not actual implementation. They are useful to define a contract between members in different types that have different implementations. Every interface is implicitly abstract.

An interface is implemented by a class using the satisfies keyword. It is allowed to implement more than one interface, in which case they are written after satisfies keyword in a comma-separated list. Ceylon allows for limited code besides for the definitions. An interface may not contain initialization logic, but can contain mixins.

shared interface Comparable<in T> {
   shared formal Comparison compare(T other);

   shared Boolean largerThan(T other) {
      return compare(other)==larger;
   }

   shared Boolean smallerThan(T other) {
      return compare(other)==smaller;
   }
   ...
}

Inheritance

Classes in Ceylon, as in Java, may only inherit from one class. Inheritance is declared using extends keyword. A class may reference itself using this keyword.

Abstract classes are classes that only serve as templates and cannot be instantiated. Otherwise it is just like an ordinary class.

Only abstract classes are allowed to have abstract methods. Abstract methods do not have any implementation and must be overridden by a subclass unless it is abstract itself.

Releases

  • A compiler was released on December 20, 2011

References

  1. ^ "Project Ceylon – Red Hat builds Java replacement". The Register. 2011-04-13. Retrieved 2011-11-27.
  2. ^ Gavin King (2011-04-13). "Ceylon". Retrieved 2011-11-27.
  3. ^ "Ceylon JVM Language". infoq.com. 2011-04-13. Retrieved 2011-11-27. First, I never billed this as a Java Killer or the next generation of the Java language. Not my words. Ceylon isn't Java, it's a new language that's deeply influenced by Java, designed by people who are unapologetic fans of Java. Java's not dying anytime soon, so nothing's killing it
  4. ^ Gavin King (2011-04-27). "Introduction to Ceylon Part 1". Retrieved 2011-11-27.

External links