Cached at:
06/08/26, 03:16 AM
TL;DR: Gleam is a deliberately "small" programming language. By trimming features, reducing redundancy, and optimizing readability, the language stays out of your way, resulting in an experience that is easy to learn, easy to use, and has excellent tooling.
## Introduction: What is Gleam
Gleam is a friendly functional programming language for building scalable, type-safe systems. Its author, Giacomo, is an Italian developer who works on the compiler and tooling. He chose not to introduce the language comprehensively, but to focus on one specific thing Gleam does exceptionally well — being **small**.
## Why "Small" Matters
Programming languages keep growing, with new features appearing constantly. While exciting, this brings problems: the language surface area expands, making it hard to fully understand, and having too many choices can be worse than having none. Gleam aims to stay focused, practical, and very small — so small that all its keywords fit neatly on a postcard.
Gleam's V1 release (two years ago) reserved some unused keywords so that future features like macros could be added without breaking the entire ecosystem. This forward-thinking design lets the language remain stable while leaving room for growth.
## The Language Core: Few but Essential Keywords
All of Gleam's keywords (including reserved ones) can be printed on a postcard. Only two-thirds are actually used; the rest exist solely to produce error messages. This minimalism isn't for its own sake — it's intentional: reducing the number of ways to do things avoids "two ways" duplication.
For example, Gleam **has no if statement**. Control flow uses `case` expressions and pattern matching. For developers used to if/else, you can think of `case` as a more powerful switch. This design eliminates the "should I use if or case?" anxiety, and also avoids giving booleans a special status, preventing the reasoning problems that come with "boolean blindness."
## Syntax Design: A Familiar Look
Gleam once had a different syntax, but later adjusted to resemble mainstream languages — because that lowers the learning curve. Functional programming already introduces new concepts; if the syntax were also unfamiliar, the learning difficulty would double. A familiar syntax helps developers get up to speed faster.
Example code:
```gleam
fn greet(name: String) {
println("Hello, " <> name)
}
["Lucy", "London"].each(greet)
```
## Type System: State-of-the-Art from the 70s
Gleam's type system is described as "state-of-the-art, but from the 70s" — relying on battle-tested ideas that make code easier to reason about, write, and refactor. Custom types are like enums but can carry data:
```gleam
type User {
LoggedIn(name: String, email: Email)
Anonymous
}
```
This covers about 80% of Gleam's type system (plus generics, and that's it). Simple, straightforward — none of TypeScript's complex type gymnastics.
## The Benefits of Small: Readability First
Gleam optimizes for readability, not conciseness. It requires a bit more typing — no implicit control flow, implicit conversions, exceptions, or null values. The compiler won't do any hidden conversions for you; everything must be explicit.
This trade-off increases typing effort but greatly improves code comprehension. Developers spend far more time reading code than writing it, and when maintaining code — your own or others — readability is far more valuable than conciseness.
## Tooling and Developer Experience
A "small" language makes it easier for tools to analyze the code. The compiler can generate excellent error messages — for example, if you try to access `user.alias`, the compiler tells you that the `User` type only has a `name` field and suggests a fix.
Gleam stands on the shoulders of Rust and Elm, borrowing their excellent error message design. But the compiler alone isn't enough; a modern language needs a complete toolchain: package management, build, test, formatting. Gleam's small core allows the team to spend time polishing these tools. For instance, the built-in formatter eliminates arguments over code style.
## Conclusion
Gleam's "smallness" is a deliberate design choice — not to limit, but to keep the language simple, easy to learn, and reliable, while enabling the tools and experience to be outstanding. It proves that sometimes less is more.
Source: Gleam and the value of small - YouTube (https://www.youtube.com/watch?v=E6_JqYMeNqs)