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
orsuper
- 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
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 can be used in cases and anonymous functions.
ceylon assemble
is ceylon fat-jar
without --flat-classpath
.
ceylon maven
can generate a Maven repository from a list of Ceylon modules.
Interpolation can be used in assertion failure message, but not in normal doc annotations.
Use fat arrows with late
annotation, to defer the initialization on first use.
--incremental
--include-dependencies