Skip to content

Instantly share code, notes, and snippets.

@weakish
Created August 25, 2018 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weakish/3b5b3ebf58fa48230d3e7f4015786857 to your computer and use it in GitHub Desktop.
Save weakish/3b5b3ebf58fa48230d3e7f4015786857 to your computer and use it in GitHub Desktop.
#ceylon 1.3 changes

What is new in Ceylon 1.3

Static members

When to use static members instead of toplevel methods or values:

  • when a function needs to access private members of a class
  • when a class needs to define private state or constants that are shared by all instances
  • factory functions

There is no current instance for a static member, so within a static member:

  • no access to this or super
  • no access to parameters of the class itself
  • call non-static members without providing an instance of the class

To adhere to the usual scoping rules of the language:

  • only a class with constructors may define static members
  • static members must be defined right at the start of the class, before the initializer section, before the constructors of the class, and before any regular non-static members of the class
  • a nested class or anonymous class may not declare static members

Local import

It is recommended to use toplevel import aliases to resolve name collisions, which provides much less potential for confusion.

Local import is useful when writing native code in a cross-platform module.

Tuples

Tuples can be used in cases and anonymous functions.

ceylon assemble

ceylon assemble is ceylon fat-jar without --flat-classpath.

Export to Maven repository

ceylon maven can generate a Maven repository from a list of Ceylon modules.

Interpolation in assertion failure message

Interpolation can be used in assertion failure message, but not in normal doc annotations.

Lazy initialization

Use fat arrows with late annotation, to defer the initialization on first use.

Compile options

  • --incremental
  • --include-dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment