7998ed5218
Also: Prefer `getURI` path when gathering location of a source |
||
---|---|---|
.. | ||
access-modifiers.md | ||
contexts.md | ||
dynamic-dispatch.md | ||
errors.md | ||
evaluation.md | ||
function-types.md | ||
goals.md | ||
hierarchy.md | ||
inference-and-checking.md | ||
intersection-types.md | ||
modules.md | ||
parallelism.md | ||
pattern-matching.md | ||
README.md | ||
references.md | ||
type-directed-programming.md | ||
types.md |
layout | title | category | tags | order | ||
---|---|---|---|---|---|---|
section-summary | Enso's Type System | types |
|
0 |
Enso's Type System
On the spectrum of programming type systems ranging from dynamically typed to statically typed, one likes to think that there is a happy medium between the two. A language that feels dynamic, with high levels of type inference, but lets the users add more type information as they want more safety and compile-time checking.
Enso aims to be that language, providing a statically-typed language with a type system that makes it feel dynamic. It will infer sensible types in many cases, but as users move from exploratory pipelines to production systems, they are able to add more and more type information to their programs, proving more and more properties using the type system. This is based on a novel type-inference engine, and a fusion of nominal and structural typing.
All in all, the type system should stay out of the users' ways unless they make a mistake, but give more experienced users the tools to build the programs that they require.
This document contains discussion and designs for the type-system's behaviour, as well as formal specifications where necessary. It discusses the impact of many syntactic language features upon inference and type checking, and is instrumental for ensuring that we build the right language.
Note
A Note on Syntax
In the aid of precision, this document will use syntax that may not be exposed to users. The appearance of a piece of syntax here that is not described in the syntax document makes no promises as to whether said syntax will be exposed in the surface language.
Warning
The specification in this section is very outdated and far from reality. Sections that are known to be "off" are marked as warning.
Information on the type system is broken up into the following sections:
- Goals for the Type System: The goals for the Enso type system, particularly around usability and user experience.
- The Type Hierarchy: The type hierarchy in Enso.
- Intersection Types: intersection types in Enso.
- Function Types: Function types in Enso.
- Access Modification: Access modifiers in Enso
(e.g.
private
andunsafe
), - Pattern Matching: The typing of pattern match expressions in Enso.
- Dynamic Dispatch: How dynamic dispatch interacts with the type system in Enso.
- Modules: A description of the Enso module system.
- Monadic Contexts: A description of the typing and functionality of Enso's monadic contexts.
- Strictness and Suspension: A description of how the type system interacts with Enso's evaluation semantics.
- Analysing Parallelism: A description of how the type system interacts with the planned automated parallelism analysis.
- Type-Directed Programming: A description of how the type system aids type-directed programming, and the features it has to support this approach.
- Errors: The interaction between Enso's errors and the type system.
- Type Inference and Checking: A description of Enso's type inference and checking system.
- References: Useful references for working on the type system and its theory.