Gleam | |
Logo Size: | 128px |
Logo Caption: | Lucy, the starfish mascot for Gleam[1] |
Paradigm: | Multi-paradigm |
Designer: | Louis Pilfold |
Developer: | Louis Pilfold |
Typing: | Type-safe, static, inferred |
Memory Management: | Garbage collected |
Programming Language: | Rust |
Influenced By: | [3] |
Operating System: | FreeBSD, Linux, macOS, OpenBSD, Windows[4] |
License: | Apache License 2.0[5] |
File Ext: | .gleam |
Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.[6] [7]
Gleam is a statically-typed language,[8] which is different from the most popular languages that run on Erlang’s virtual machine BEAM, Erlang and Elixir. Gleam has its own type-safe implementation of OTP, Erlang's actor framework.[9] Packages are provided using the Hex package manager, and an index for finding packages written for Gleam is available.[10]
The first numbered version of Gleam was released on April 15, 2019.[11] Compiling to JavaScript was introduced with version v0.16.[12]
In 2023 the Erlang Ecosystem Foundation funded the creation of a course for learning Gleam on the learning platform Exercism.[13]
Version v1.0.0 was released on March 4, 2024.[14]
Gleam includes the following features, many common to other functional programming languages:[7]
A "Hello, World!" example:
pub fn main
Gleam supports tail call optimization:[15]
fn factorial_loop(x: Int, accumulator: Int) -> Int
Gleam's toolchain is implemented in the Rust programming language. The toolchain is a single native binary executable which contains the compiler, build tool, package manager, source code formatter, and language server. A WebAssembly binary containing the Gleam compiler is also available, enabling Gleam code to be compiled within a web browser.