The topic of this article may not meet Misplaced Pages's general notability guideline. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted. Find sources: "Gleam" programming language – news · newspapers · books · scholar · JSTOR (March 2024) (Learn how and when to remove this message) |
Lucy, the starfish mascot for Gleam | |
Paradigm | Multi-paradigm: functional, concurrent |
---|---|
Designed by | Louis Pilfold |
Developer | Louis Pilfold |
First appeared | June 13, 2016; 8 years ago (2016-06-13) |
Stable release | 1.7.0 / 4 January 2025 |
Typing discipline | Type-safe, static, inferred |
Memory management | Garbage collected |
Implementation language | Rust |
OS | FreeBSD, Linux, macOS, OpenBSD, Windows |
License | Apache License 2.0 |
Filename extensions | .gleam |
Website | gleam |
Influenced by | |
Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.
Gleam is a statically-typed language, 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. Packages are provided using the Hex package manager, and an index for finding packages written for Gleam is available.
History
The first numbered version of Gleam was released on April 15, 2019. Compiling to JavaScript was introduced with version v0.16.
In 2023 the Erlang Ecosystem Foundation funded the creation of a course for learning Gleam on the learning platform Exercism.
Version v1.0.0 was released on March 4, 2024.
Features
Gleam includes the following features, many common to other functional programming languages:
- Result type for error handling
- Immutable objects
- Algebraic data types
- Pattern matching
- No null pointers
- No implicit type conversions
Example
A "Hello, World!" example:
import gleam/io pub fn main() { io.println("hello, world!") }
Gleam supports tail call optimization:
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
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.
References
- "gleam-lang/gleam Issues - New logo and mascot #2551". GitHub.
- ^ "Gleam Homepage". 2024.
- "Release 1.7.0". January 4, 2025. Retrieved January 21, 2025.
- "Installing Gleam". 2024.
- "Gleam License File". GitHub. December 5, 2021.
- Pilfold, Louis (February 7, 2024). "Gleam: Past, Present, Future!". Fosdem 2024 – via YouTube.
- Krill, Paul (March 5, 2024). "Gleam language available in first stable release". InfoWorld. Retrieved March 26, 2024.
- ^ Eastman, David (June 22, 2024). "Introduction to Gleam, a New Functional Programming Language". The New Stack. Retrieved July 29, 2024.
- De Simone, Sergio (March 16, 2024). "Erlang-Runtime Statically-Typed Functional Language Gleam Reaches 1.0". InfoQ. Retrieved March 26, 2024.
- Getting to know Actors in Gleam - Raúl Chouza. Code BEAM America. March 27, 2024. Retrieved May 6, 2024 – via YouTube.
- "Introducing the Gleam package index – Gleam". gleam.run. Retrieved May 7, 2024.
- "Hello, Gleam! – Gleam". gleam.run. Retrieved May 6, 2024.
- "v0.16 - Gleam compiles to JavaScript! – Gleam". gleam.run. Retrieved May 7, 2024.
- Alistair, Woodman (December 2023). "Erlang Ecosystem Foundation Annual General Meeting 2023 Chair's Report".
- "Gleam version 1 – Gleam". gleam.run. Retrieved May 7, 2024.
- "Tail Calls". The Gleam Language Tour. Retrieved March 26, 2024.
- gleam-lang/gleam, Gleam, May 6, 2024, retrieved May 6, 2024
External links
This article is a stub. You can help Misplaced Pages by expanding it. |
- Programming languages
- JavaScript
- Erlang (programming language)
- Concurrent programming languages
- Free and open source compilers
- Free software projects
- Functional languages
- High-level programming languages
- Multi-paradigm programming languages
- Pattern matching programming languages
- Programming languages created in 2016
- Software using the Apache license
- Statically typed programming languages