Gleam (programming language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Gleam
Lucy, the starfish mascot for Gleam[1]
ParadigmMulti-paradigm: functional, concurrent[2]
Designed byLouis Pilfold
DeveloperLouis Pilfold
First appearedJune 13, 2016; 9 years ago (2016-06-13)
Typing disciplineType-safe, static, inferred[2]
Memory managementGarbage collected
Implementation languageRust
OSFreeBSD, Linux, macOS, OpenBSD, Windows[3]
LicenseApache License 2.0[4]
Filename extensions.gleam
Websitegleam.run
Influenced by
[5]

Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

Gleam is a general-purpose, concurrent, functional, high-level programming language that compiles to Erlang or JavaScript source code.[2][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]

History

[edit | edit source]

Gleam was originally created in 2016 by Louis Pilfold for a conference talk. It was later redesigned and adapted into what it is today.[5]

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]

In April 2025, Thoughtworks added Gleam to its Technology Radar in the Assess ring (languages & frameworks worth exploring). [15]

Adoption

[edit | edit source]

Gleam has seen some adoption in recent years.[16] According to a blog post, the language creators have placed strong emphasis on developer experience (DX), which has contributed to its appeal.[17][better source needed]

Although it compiles to run on the BEAM virtual machine, most new Gleam users do not have a background in Erlang nor Elixir, two older BEAM languages.[18] In 2025, Louis Pilfold reported on results from the 2024 developer survey, which received 841 responses.[18] Pilfold concluded that Gleam developers "overwhelmingly come from other ecosystems other than Erlang and Elixir".[18] The core team also reported on Gleam's efforts to expand the BEAM ecosystem in a keynote talk at Code BEAM Europe 2024.[19]

Developers have cited Gleam’s simplicity, static typing, and user-friendly tooling as reasons for adoption.[20] The developer behind Nestful described their motivations for rewriting the project in Gleam as driven by its clarity and ease of use.[21] There is a community-maintained list of companies using Gleam in production.[22]

In 2025, Gleam appeared for the first time in the Stack Overflow Developer Survey, where it was the 2nd "most admired" language, with 70% of users currently using the language wanting to continue working with it.[16] 1.1% of developer respondents reported doing "extensive development work" in the language over the past year.[16]

Features

[edit | edit source]

Gleam includes the following features.[7][23]

Example

[edit | edit source]

A "Hello, World!" example:

import gleam/io

pub fn main() {
  io.println("hello, world!")
}

Gleam supports tail call optimization:[24]

pub fn factorial(x: Int) -> Int {
  // The public function calls the private tail recursive function
  factorial_loop(x, 1)
}

fn factorial_loop(x: Int, accumulator: Int) -> Int {
  case x {
    1 -> accumulator

    // The last thing this function does is call itself
    _ -> factorial_loop(x - 1, accumulator * x)
  }
}

Implementation

[edit | edit source]

Gleam's toolchain is implemented in the Rust programming language.[25] The toolchain is a single native binary executable which contains the compiler, build tool, package manager, source code formatter, and language server.[citation needed] A WebAssembly binary containing the Gleam compiler is also available, enabling Gleam code to be compiled within a web browser.[26] This is used in Gleam's interactive language tour[27] and online playground.[28]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  7. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  11. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  12. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  14. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  15. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  16. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  17. ^ Why Gleam Is Good
  18. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  19. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  20. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  21. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  22. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  23. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  24. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  25. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  26. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  27. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  28. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
[edit | edit source]