Current section
Files
Jump to
Current section
Files
README.md
# Gleam OTP<a href="https://github.com/gleam-lang/otp/releases"><img src="https://img.shields.io/github/release/gleam-lang/otp" alt="GitHub release"></a><a href="https://discord.gg/Fm8Pwmy"><img src="https://img.shields.io/discord/768594524158427167?color=blue" alt="Discord chat"></a>A Gleam library for building fault tolerant multi-core programs using theactor model. It is compatible with Erlang's OTP framework.This library is experimental and will likely have many breaking changes in thefuture!## Actor hierarchyThis library defines several different types of actor that can be used inGleam programs.``` Process ↙ ↘ Actor Task ↓Supervisor```### ProcessThe process is the lowest level building block of OTP, all other actors arebuilt on top of processes either directly or indirectly. Typically thisabstraction would be not be used very often in Gleam applications, favourother actor types that provide more functionality.### ActorThe `actor` is the most commonly used process type in Gleam and serves as a goodbuilding block for other abstractions. Like Erlang's `gen_server` it willautomatically handle OTP's debug system messages for you.### TaskA task is a kind of process that performs a single task and then shuts down.Commonly tasks are used to convert sequential code into concurrent code byperforming computation in another process.### SupervisorSupervisors is a process that starts and then supervises a group of processes,restarting them if they crash. Supervisors can start other supervisors,resulting in a hierarchical process structure called a supervision tree,providing fault tolerance to a Gleam application.## Limitations and known issuesThis library is experimental there are some limitations that not yet been resolved.- There is no support for named processes.- Actors do not yet support all OTP system messages. Unsupported messages are dropped.- Supervisors do not yet support different shutdown period per child. In practice this means that children that are supervisors do not get an unlimited amount of time to shut down, as is expected in Erlang or Elixir.- This library has not seen much testing compared to the Erlang OTP libraries, both in terms of unit tests and real world testing in applications.