The Ceylon Language
Next
The Ceylon Language
Say more, more clearly
Gavin
King
Community review draft (M5)
Table of Contents
A work in progress
1. Introduction
1.1. Language overview
1.1.1. Runtime and platform
1.2. Type system
1.2.1. Mixin inheritance
1.2.2. Algebraic types, self types, and type families
1.2.3. Simplified generics
1.2.4. Union and intersection types
1.2.5. Type aliases and type inference
1.2.6. Metaprogramming
1.3. Object-oriented programming
1.3.1. Class initialization and instantiation
1.3.2. Functions, methods, values, and attributes
1.3.3. Defaulted parameters and variadic parameters
1.3.4. First-class functions and higher-order programming
1.3.5. Naming conventions, annotations, and inline documentation
1.3.6. Named arguments and tree-like structures
1.3.7. Modularity
1.4. Language module
1.4.1. Operators and operator polymorphism
1.4.2. Numeric types
1.4.3. Compile-time safety for optional values and type narrowing
1.4.4. Iterable objects and comprehensions
1.4.5. Sequences and tuples
2. Lexical structure
2.1. Whitespace
2.2. Comments
2.3. Identifiers and keywords
2.4. Literals
2.4.1. Numeric literals
2.4.2. Character literals
2.4.3. String literals
2.5. Operators and delimiters
2.6. Source layout
3. Type system
3.1. Identifier naming
3.2. Types
3.2.1. Member distinctness
3.2.2. Subtyping
3.2.3. Union types
3.2.4. Intersection types
3.2.5. The bottom type
3.2.6. Type expressions
3.2.7. Type abbreviations
3.2.8. Type inference
3.3. Inheritance
3.3.1. Principal instantiation inheritance
3.3.2. Extension
3.3.3. Satisfaction
3.4. Case enumeration and coverage
3.4.1. Coverage
3.4.2. Cases
3.4.3. Disjoint types
3.5. Generic type parameters
3.5.1. Type parameters and variance
3.5.2. Variance validation
3.5.3. Type parameters and enumerated types
3.5.4. Generic type constraints
3.6. Generic type arguments
3.6.1. Type arguments and type constraints
3.6.2. Produced types and and variance
3.6.3. Qualified types
3.6.4. Type argument substitution
3.6.5. Type argument inference
4. Declarations
4.1. Compilation unit structure
4.1.1. Toplevel and nested declarations
4.2. Imports
4.2.1. Type imports
4.2.2. Function and value imports
4.2.3. Alias imports
4.2.4. Wildcard imports
4.2.5. Imported name
4.3. Parameters
4.3.1. Required parameters
4.3.2. Defaulted parameters
4.3.3. Variadic parameters
4.3.4. Value parameters
4.3.5. Callable parameters
4.4. Interfaces
4.4.1. Interface bodies
4.4.2. Interface inheritance
4.4.3. Interfaces with enumerated cases
4.4.4. Interface aliases
4.5. Classes
4.5.1. Callable type of a class
4.5.2. Initializer section
4.5.3. Declaration section
4.5.4. Class inheritance
4.5.5. Restrictions on user-defined classes
4.5.6. Abstract, formal, and default classes
4.5.7. Member class refinement
4.5.8. Anonymous classes
4.5.9. Classes with enumerated cases
4.5.10. Class aliases
4.6. Type aliases
4.7. Functions
4.7.1. Callable type of a function
4.7.2. Functions with blocks
4.7.3. Functions with specifiers
4.7.4. Function return type inference
4.7.5. Forward declaration of functions
4.7.6. Functions with multiple parameter lists
4.7.7. Formal and default methods
4.7.8. Method refinement
4.8. Values
4.8.1. References
4.8.2. Getters
4.8.3. Setters
4.8.4. Value type inference
4.8.5. Forward declaration of values
4.8.6. Formal and default attributes
4.8.7. Attribute refinement
4.9. Program element annotations
4.9.1. Annotation arguments
4.9.2. Annotation types
4.9.3. Annotation values
4.10. Declaration modifiers
4.10.1. Refinement modifiers
4.10.2. Visibility and name resolution
4.10.3. Documentation
5. Statements, blocks, and control structures
5.1. Block structure
5.1.1. Declaration name uniqueness
5.1.2. Scope of a declaration
5.1.3. Hiding a declaration
5.1.4. References and block structure
5.1.5. Type inference and block structure
5.1.6. Unqualified reference resolution
5.1.7. Qualified reference resolution
5.1.8. Local references and closure
5.2. Blocks and statements
5.2.1. Expression statements
5.2.2. Control directives
5.2.3. Specification statements
5.2.4. Definite return
5.2.5. Definite initialization
5.2.6. Definite uninitialization
5.3. Control structures and assertions
5.3.1. Control structure variables
5.3.2. Iteration variables
5.3.3. Control structure conditions
5.3.4. Boolean conditions
5.3.5. Assignability, existence, and nonemptiness conditions
5.3.6. if/else
5.3.7. switch/case/else
5.3.8. for/else
5.3.9. while
5.3.10. try/catch/finally
5.3.11. Assertions
5.3.12. Dynamic blocks
6. Expressions
6.1. Literal values
6.1.1. Integer number literals
6.1.2. Floating point number literals
6.1.3. Character literals
6.1.4. Character string literals
6.2. Constant expressions
6.3. String templates
6.4. Self references and the current package reference
6.4.1. this
6.4.2. outer
6.4.3. super
6.4.4. package
6.5. Anonymous functions
6.6. Compound expressions
6.6.1. Base expressions and qualified expressions
6.6.2. Value references
6.6.3. Callable references
6.7. Invocation expressions
6.7.1. The type of a list of arguments
6.7.2. Default arguments
6.7.3. Listed arguments
6.7.4. Spread arguments
6.7.5. Comprehensions
6.7.6. Iterable and tuple enumeration
6.7.7. Positional argument lists
6.7.8. Named argument lists
6.8. Conditional expressions and anonymous class expressions
6.8.1. Inline conditional expressions
6.8.2. Inline anonymous class expressions
6.9. Operators
6.9.1. Operator precedence
6.9.2. Operator definition
6.9.3. Basic invocation and assignment operators
6.9.4. Equality and comparison operators
6.9.5. Logical operators
6.9.6. Operators for handling null values
6.9.7. Correspondence and sequence operators
6.9.8. Operators for creating objects
6.9.9. Conditional operators
6.9.10. Arithmetic operators
6.9.11. Set operators
7. Execution
7.1. Object instances, identity, and reference passing
7.1.1. Value type optimizations
7.2. Sequential execution and closure
7.2.1. Sequential execution of a body
7.2.2. Closure of a class or interface
7.2.3. Closure of a block
7.2.4. Initialization of toplevel references
7.3. Execution of control structures and assertions
7.3.1. Evaluation of condition lists
7.3.2. Validation of assertions
7.3.3. Execution of conditionals
7.3.4. Execution of loops
7.3.5. Exception handling
7.4. Evaluation, invocation, and assignment
7.4.1. Evaluation
7.4.2. Invocation
7.4.3. Assignment
7.5. Operator expressions
7.5.1. Operator expression optimization
7.5.2. Numeric operations
7.6. Evaluation of comprehensions and spread arguments
7.7. Evaluation of enumerations
7.8. Exceptions
7.9. Reification
7.10. Concurrency
8. Module system
8.1. The module runtime and module isolation
8.1.1. Module isolation for the Java platform
8.1.2. Module isolation for the JavaScript platform
8.2. Module architecture
8.2.1. Module names and version identifiers
8.2.2. Module archive names for the Java platform
8.2.3. Module script names for the JavaScript platform
8.2.4. Source archive names
8.2.5. Module archives
8.2.6. Module scripts
8.2.7. Source archives
8.2.8. Module repositories
8.2.9. Package descriptors
8.2.10. Module descriptors