Content deleted Content added
JJMC89 bot (talk | contribs) m Add {{drafts moved from mainspace}} |
comma |
||
(47 intermediate revisions by 29 users not shown) | |||
Line 1:
{{Short description|Programming language}}
{{Use American English|date=March 2024}}
{{Use mdy dates|date=March 2024}}
{{Infobox programming language
| name = Gleam
| logo = [[File:
| logo size = 128px
| logo caption = Lucy, the starfish mascot for Gleam<ref>{{cite web | url=https://github.com/gleam-lang/gleam/issues/2551 | title=gleam-lang/gleam Issues
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[functional programming|functional]], [[concurrent programming|concurrent
| year = {{start date and age|2016|6|13}}
| designer =
| developer =
| latest release version = {{wikidata|property|preferred|references|edit|Q66370905|P348}}
| latest release date = {{wikidata|qualifier|preferred|single|Q66370905|P348|P548=Q2804309|P577}}
| typing = [[Type safety|Type-safe]], [[Static typing|static]], [[Type inference|inferred]]<ref name=
| memory management = [[Garbage collection (computer science)|Garbage collected]]
| programming language = [[Rust (programming language)|Rust]]
| dialects =
| influenced_by = {{cslist|
Alpaca|
[[
[[C++]]|▼
[[Go (programming language)|Go]]|▼
[[Erlang (programming language)|Erlang]]|
[[Elixir (programming language)|Elixir]]|
▲[[Go (programming language)|Go]]|
[[OCaml]]|
[[Rust (programming language)|Rust]]|
}}<ref>{{cite journal | url=https://www.youtube.com/watch?v=clsTrQUt-4M&t=304 | date=2024-02-07 | title=Gleam: Past, Present, Future! | first=Louis | last=Pilfold | journal=Fosdem 2024 | via=YouTube }}</ref>
| influenced = ▼
}}▼
| operating_system = [[FreeBSD]], [[Linux]], [[macOS]], [[OpenBSD]], [[Windows]]<ref>{{cite web|url=https://gleam.run/getting-started/installing/|title=Installing Gleam|date=2024}}</ref>
▲| influenced =
|
| file_ext = .gleam
| website = {{URL|https://gleam.run/}}
}}
{{Portal|Computer programming|Free and open-source software}}
'''Gleam''' is a [[General-purpose programming language|general-purpose]], [[concurrent computing|concurrent]], [[Functional programming|functional]], [[High-level programming language|high-level]] [[programming language]] that compiles to [[Erlang (programming language)|Erlang]] or [[JavaScript]] source code.<ref name=
Gleam is a statically-typed language,<ref>{{cite news | url=https://www.infoq.com/news/2024/03/gleam-erlang-virtual-machine-1-0/ | title=Erlang-Runtime Statically-Typed Functional Language Gleam Reaches 1.0 | first=Sergio | last=De Simone | work=InfoQ | date=16 March 2024 | access-date=26 March 2024}}</ref> which is different from the most popular languages that run on Erlang’s virtual machine [[BEAM (Erlang virtual machine)|BEAM]], [[Erlang (programming language)|Erlang]] and [[Elixir (programming language)|Elixir]]. Gleam has its own type-safe implementation of OTP, Erlang's actor framework.<ref>{{Cite AV media |url=https://www.youtube.com/watch?v=WaHx6n2UZJg |title=Getting to know Actors in Gleam – Raúl Chouza | series=Code BEAM America | date=2024-03-27 |language=en |access-date=2024-05-06 |via=YouTube}}</ref> Packages are provided using the Hex [[package manager]], and an index for finding packages written for Gleam is available.<ref>{{Cite web |title=Introducing the Gleam package index – Gleam |url=https://gleam.run//news/introducing-the-gleam-package-index/ |access-date=2024-05-07 |website=gleam.run |language=en-GB}}</ref>
==References==▼
== History ==
The first numbered version of Gleam was released on April 15, 2019.<ref>{{Cite web |title=Hello, Gleam! – Gleam |url=https://gleam.run//news/hello-gleam/ |access-date=2024-05-06 |website=gleam.run |language=en-GB}}</ref> Compiling to JavaScript was introduced with version v0.16.<ref>{{Cite web |title=v0.16 – Gleam compiles to JavaScript! – Gleam |url=https://gleam.run//news/v0.16-gleam-compiles-to-javascript/ |access-date=2024-05-07 |website=gleam.run |language=en-GB}}</ref>
In 2023 the Erlang Ecosystem Foundation funded the creation of a course for learning Gleam on the learning platform [[Exercism]].<ref>{{Cite web |last=Alistair |first=Woodman |date=December 2023 |title=Erlang Ecosystem Foundation Annual General Meeting 2023 Chair's Report |url=https://erlef.org/public_records/}}</ref>
Version v1.0.0 was released on March 4, 2024.<ref>{{Cite web |title=Gleam version 1 – Gleam |url=https://gleam.run//news/gleam-version-1/ |access-date=2024-05-07 |website=gleam.run |language=en-GB}}</ref>
In April 2025, [[Thoughtworks]] added Gleam to its Technology Radar in the Assess ring (languages & frameworks worth exploring). <ref>{{cite web | url=https://www.thoughtworks.com/radar/languages-and-frameworks/gleam | title=Thoughtworks Technology Radar, Gleam|date=2025}}</ref>
== Adoption ==
Gleam has seen some adoption in recent years.<ref name=SOSurvey/> According to a blog post, the language creators have placed strong emphasis on developer experience (DX), which has contributed to its appeal.<ref>[https://tahazsh.com/blog/why-gleam-is-good/ Why Gleam Is Good]</ref>{{Better source needed|date=August 2025}}
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.<ref name=GleamSurveyPilfold/> In 2025, Louis Pilfold reported on results from the 2024 developer survey, which received 841 responses.<ref name=GleamSurveyPilfold>{{Cite web |title=Developer Survey 2024 Results |last=Pilfold |first=Louis |url=https://gleam.run/news/developer-survey-2024-results |access-date=2025-08-09 |website=gleam.run}}</ref> Pilfold concluded that Gleam developers "overwhelmingly come from other ecosystems other than Erlang and Elixir".<ref name=GleamSurveyPilfold/>
The core team also reported on Gleam's efforts to expand the BEAM ecosystem in a keynote talk at Code BEAM Europe 2024.<ref>{{Cite AV media |url=https://www.youtube.com/watch?v=6I0IbJtUC3U |title=Keynote: Gleam's Journey on the BEAM - Hayleigh Thompson & Louis Pilfold {{!}} Code BEAM Europe 2024 |date=2024-10-28 |last=Code Sync |access-date=2025-08-09 |via=YouTube}}</ref>
Developers have cited Gleam’s simplicity, static typing, and user-friendly tooling as reasons for adoption.{{cn|date=August 2025}} The developer behind Nestful described their motivations for rewriting the project in Gleam as driven by its clarity and ease of use.<ref>{{Cite web |last=Nestful |title=Why I Rewrote Nestful in Gleam |url=https://blog.nestful.app/p/why-i-rewrote-nestful-in-gleam |access-date=2025-08-09 |website=blog.nestful.app |language=en}}</ref> There is a community-maintained list of companies using Gleam in production.<ref>{{Citation |last=Harris-Holt |first=Isaac |title=isaacharrisholt/gleam-in-production |date=2025-07-31 |url=https://github.com/isaacharrisholt/gleam-in-production |access-date=2025-08-09}}</ref>
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.<ref name=SOSurvey>{{Cite web |title=Technology {{!}} 2025 Stack Overflow Developer Survey |url=https://survey.stackoverflow.co/2025/technology |access-date=2025-08-09 |website=survey.stackoverflow.co |language=en}}</ref> 1.1% of developer respondents reported doing "extensive development work" in the language over the past year.<ref name=SOSurvey/>
== Features ==
{{See also|Functional programming}}
Gleam includes the following features.<ref name="eastman"/><ref name="techgig">{{cite web | url=https://content.techgig.com/technology/meet-gleam-a-new-programming-language-for-developers/articleshow/111258887.cms | title=Meet GLEAM: A new programming language for developers | first=Gaurav | last=Sharma | date=2024-06-25}}</ref>
* [[Result type]] for error handling
* [[Immutable object]]s
* [[Algebraic data type]]s
* [[Pattern matching]]
* No [[null pointer]]s
* No [[implicit type conversion]]s
== Example ==
A [["Hello, World!" program|"Hello, World!"]] example:
<syntaxhighlight lang="gleam">
import gleam/io
pub fn main() {
io.println("hello, world!")
</syntaxhighlight>
Gleam supports [[tail call]] optimization:<ref>{{cite web | url=https://tour.gleam.run/flow-control/tail-calls/ | title=Tail Calls | website=The Gleam Language Tour | access-date=26 March 2024}}</ref>
<syntaxhighlight lang="gleam">
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)
}
}
</syntaxhighlight>
== Implementation ==
Gleam's toolchain is implemented in the [[Rust (programming language)|Rust programming language]].<ref>{{Cite web |title=gleam-lang/gleam |date=2024-05-06 |url=https://github.com/gleam-lang/gleam |access-date=2024-05-06 |publisher=Gleam}}</ref> The toolchain is a single native binary executable which contains the compiler, build tool, package manager, source code formatter, and [[Language Server Protocol|language server]].{{cn|date=August 2025}} A [[WebAssembly]] binary containing the Gleam compiler is also available, enabling Gleam code to be compiled within a [[web browser]].{{cn|date=August 2025}}
▲== References ==
{{Reflist}}
== External links ==
* {{Official website|https://gleam.run/}}
* {{GitHub|gleam-lang}}
[[Category:Programming languages]]
[[Category:JavaScript]]
[[Category:Erlang (programming language)]]
[[Category:Concurrent programming languages]]
[[Category:Free and open source compilers]]
[[Category:Free software projects]]
[[Category:Functional languages]]
[[Category:High-level programming languages]]
[[Category:Multi-paradigm programming languages]]
[[Category:Pattern matching programming languages]]
[[Category:Programming languages created in 2016]]
[[Category:Software using the Apache license]]
[[Category:Statically typed programming languages]]
{{prog-lang-stub}}
|