diff --git a/lib/elixir/pages/references/typespecs.md b/lib/elixir/pages/references/typespecs.md index 95eb40253f2..49d39f30e24 100644 --- a/lib/elixir/pages/references/typespecs.md +++ b/lib/elixir/pages/references/typespecs.md @@ -1,7 +1,12 @@ # Typespecs reference -Elixir comes with a notation for declaring types and specifications. This document is a -reference into their uses and syntax. +> #### Typespecs are not set-theoretic types {: .warning} +> +> Elixir is in the process of implementing its +> [own type system](./gradual-set-theoretic-types.md) based on set-theoretic types. +> Typespecs, which are described in the following document, are a distinct notation +> for declaring types and specifications based on Erlang. +> Typespecs may be phased out as the set-theoretic type effort moves forward. Elixir is a dynamically typed language, and as such, type specifications are never used by the compiler to optimize or modify code. Still, using type specifications is useful because: @@ -48,6 +53,13 @@ The syntax Elixir provides for type specifications is similar to [the one in Erl The notation to represent the union of types is the pipe `|`. For example, the typespec `type :: atom() | pid() | tuple()` creates a type `type` that can be either an `atom`, a `pid`, or a `tuple`. This is usually called a [sum type](https://en.wikipedia.org/wiki/Tagged_union) in other languages +> #### Differences with set-theoretic types {: .warning} +> +> While they do share some similarities, the types below do not map one-to-one +> to the new types from the set theoretic type system. +> For example, there is no plan to support subsets of the `integer()` type such +> as positive, ranges or literals. + ### Basic types type ::