The Ceylon Language

The Ceylon Language

The Ceylon Language Say more, more clearly Version: 1.3 Table of Contents Welcome to Ceylon ........................................................................................................................... vii 1. Introduction .................................................................................................................................. 1 1.1. Language overview ............................................................................................................... 1 1.1.1. Runtime and platform .................................................................................................. 1 1.2. Type system ......................................................................................................................... 1 1.2.1. Mixin inheritance ........................................................................................................ 2 1.2.2. Sum types, self types, and type families .......................................................................... 2 1.2.3. Simplified generics ..................................................................................................... 2 1.2.4. Union and intersection types ......................................................................................... 3 1.2.5. Type aliases and type inference ..................................................................................... 3 1.2.6. Metaprogramming ...................................................................................................... 4 1.3. Object-oriented programming .................................................................................................. 4 1.3.1. Class initialization and instantiation ............................................................................... 4 1.3.2. Functions, methods, values, and attributes ....................................................................... 5 1.3.3. Defaulted parameters and variadic parameters .................................................................. 5 1.3.4. First-class functions and higher-order programming .......................................................... 5 1.3.5. Naming conventions, annotations, and inline documentation ............................................... 5 1.3.6. Named arguments and tree-like structures ........................................................................ 6 1.3.7. Modularity ................................................................................................................ 6 1.4. Language module .................................................................................................................. 6 1.4.1. Operators and operator polymorphism ............................................................................ 6 1.4.2. Numeric and character types ......................................................................................... 6 1.4.3. Compile-time safety for null values and flow-sensitive typing ............................................. 7 1.4.4. Streams and comprehensions ........................................................................................ 7 1.4.5. Sequences and tuples ................................................................................................... 7 2. Lexical structure ............................................................................................................................ 9 2.1. Whitespace .......................................................................................................................... 9 2.2. Comments ........................................................................................................................... 9 2.3. Identifiers and keywords ........................................................................................................10 2.4. Literals ...............................................................................................................................11 2.4.1. Numeric literals .........................................................................................................11 2.4.2. Character literals .......................................................................................................13 2.4.3. String literals ............................................................................................................14 2.5. Operators and delimiters ........................................................................................................14 3. Type system ..................................................................................................................................16 3.1. Identifier naming ..................................................................................................................17 3.2. Types .................................................................................................................................17 3.2.1. Member distinctness ...................................................................................................18 3.2.2. Subtyping .................................................................................................................18 3.2.3. Union types ..............................................................................................................19 3.2.4. Intersection types .......................................................................................................19 3.2.5. The bottom type ........................................................................................................20 3.2.6. Principal typing .........................................................................................................21 3.2.7. Type expressions .......................................................................................................21 3.2.8. Type abbreviations .....................................................................................................22 3.2.9. Type inference ..........................................................................................................23 3.2.10. Type alias elimination ...............................................................................................24 3.3. Inheritance ..........................................................................................................................24 3.3.1. Inheritance and subtyping ............................................................................................25 3.3.2. Extension .................................................................................................................25 3.3.3. Satisfaction ...............................................................................................................26 3.4. Case enumeration and coverage ..............................................................................................27 3.4.1. Coverage ..................................................................................................................27 3.4.2. Cases .......................................................................................................................28 3.4.3. Generic enumerated types ............................................................................................29 3.4.4. Disjoint types ............................................................................................................29 3.5. Generic type parameters ........................................................................................................30 Project Ceylon: 1.3 ii The Ceylon Language 3.5.1. Type parameters and variance ......................................................................................31 3.5.2. Variance validation ....................................................................................................31 3.5.3. Generic type constraints ..............................................................................................33 3.6. Generic type arguments .........................................................................................................34 3.6.1. Type arguments and variance .......................................................................................35 3.6.2. Type argument substitution ..........................................................................................35 3.6.3. Type arguments and type constraints .............................................................................35 3.6.4. Applied types and and variance ....................................................................................36 3.6.5. Type argument inference .............................................................................................37 3.7. Principal instantiations and polymorphism ................................................................................39 3.7.1. Inherited instantiations ................................................................................................40 3.7.2. Type argument distinctness ..........................................................................................40 3.7.3. Principal instantiation inheritance .................................................................................40 3.7.4. Principal instantiation of a supertype .............................................................................41 3.7.5. Refinement ...............................................................................................................42 3.7.6. Qualified types

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    163 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us