docLang

Fantom language documentation

Fundamentals

  1. Structure

    pod::type.slot program structure

    Overview, Pods, Types, Slots

  2. Literals

    syntax for literal types

    Overview, Bool, Int, Float, Decimal, Str, Duration, Uri, Type, Slot, Range, List, Map

  3. Expressions

    syntax for expressions

    Operator Precedence, Shortcut Operators, Same Operators, Conditional Operators, Ternary Operator, Null Convenience Operators, Type Checking, Indexing, Bitwise Operators, Serialization Expressions, Advanced Operators

  4. Statements

    syntax for statements

    Overview, Expression Statements, Return Statement, Local Variables, If Statements, Loop Statement, Switch Statement, Exception Handling

  5. Exceptions

    exception handling

    Overview, Err Class, Throw Statement, Try-Catch Statement, Finally Blocks

Type System

  1. TypeSystem

    static type system with bit of dynamic thrown in

    Overview, Types, Pure Object Oriented, Nullable Types, Value-Types, Statically Typed, Implicit Casts, Type Signatures, Collections, Generics, Subtype Substitution

  2. CompilationUnits

    organization of source code

    Organization, Char Encoding, Anatomy of Source File, Using, Comments

  3. Pods

    creating pods

    Overview, Pod Meta

  4. Classes

    creating class types

    Overview, Class Modifiers, Obj, Instances, Reflection

  5. Mixins

    creating mixin types

    Overview, Mixin Modifiers

  6. Enums

    creating enum types

    Overview, Range, Enum Constructors, Enum Modifiers, Reflection

  7. Slots

    slot model

    Overview, Slot Modifiers

  8. Methods

    deep dive into method slots

    Overview, This, Constructors, Static Initializers, Default Parameters, Operators, Virtual Methods, Abstract Methods, Once Methods, Covariance, This Returns, Dynamic Invoke, Native Methods

  9. Fields

    deep dive into field slots

    Overview, Simple Fields, Accessor Methods, Calculated Fields, Const Fields, Static Fields, Protection Scope, Readonly Fields, Virtual Fields, Abstract Fields, Definite Assignment, Overriding a Method, Mixins, Native Fields

  10. Inheritance

    rules for slot inheritance

    Overview, Syntax, Inheritance Rules, Inheritance Restrictions, Overrides, Covariance, Super

  11. Facets

    annotating types and slots with metadata

    Overview, Facet Classes, Annotations, Reflection, Inheritance

Functions

  1. Functions

    functional programming

    Overview, Function Signatures, Calling Functions, Type Compatibility, Methods, Immutable Functions

  2. Closures

    deep dive into closures

    Overview, Syntax, Binding Locals, Closure Parameters, Iteration, Closure Type Inference, It-Blocks, This Functions, With-Blocks

Interop

  1. JavaFFI

    Java foreign function interface

    Overview, Interop Summary, How it Works, Class Path - Compiler, Class Path - Runtime, Primitives, Reflection, Arrays, Nullable, Overloaded Methods, Constructors, Subclassing, Overrides, Inner Classes, Dynamic Calls, Functions as Interfaces, Annotations

  2. Natives

    implementing methods and fields in Java and C# code

    Overview, Native Classes, Native Peers, Native Methods, Native Fields

  3. JavaScript

    compiling to JavaScript

    Overview, Js Facet, Deployment, Browser Runtime, Alternative Runtimes, Invoking Fantom from JavaScript, Natives, Testing

Advanced

  1. Deployment

    how to deploy pods and applications

    Overview, Natives, Dependencies, Application Deployment

  2. Env

    customizing the Fantom environment

    Overview, Directory Structure, BootEnv, Setting Env, PathEnv, JarDistEnv, Indexed Props

  3. Serialization

    reading/writing objects

    Overview, Data Model, Serializable, Simple, Collection, Streams, Syntax

  4. Concurrency

    model for sharing data between threads

    Overview, Immutability, Shared Objects

  5. Actors

    message passing concurrency

    Overview, Actors, Actor Locals, Message Passing, Futures, Message Error Handling, Timers, Chaining, Coalescing Messages, Flow Control, Actor Pools

  6. Naming

    URI naming system

    Overview, Resolving Uris, Uri Schemes, Fan Scheme

  7. Logging

    logging APIs

    Log Creation, Log Statements, Log Levels, Log Handlers, Log Setup

  8. Localization

    localization APIs

    Locale, Localized Properties, Locale Literals

  9. DSLs

    domain specific language and compiler plugins

    Overview, Built-in DSLs, DslPlugins

  10. DateTime

    date and time APIs

    Overview, Ticks, DateTime, Localization and Formatting, TimeZone, Trade-offs

Appendix

  1. Appendix

    additional detailed notes

    Type Inference

  2. Conventions

    coding conventions we use

    Overview, Source Files, Naming, Common Names, Indention, Statements, Comments

  3. Grammar

    formal BNF syntax grammar

    Legend, Compilation Unit, Type Def, Slot Def, Facets, Stmt, Expr, Type, Misc, Keywords, Position Keyword