3 ms·
I’m trying Gleam out right now, and having most recently been writing Go, I’m really loving: - No nil, instead Option and Result - ADTs - Pattern matching + des
by smweber 9mo ago
I’m trying Gleam out right now, and having most recently been writing Go, I’m really loving:
- No nil, instead Option and Result
- ADTs
- Pattern matching + destructuring
- Immutable everything by default
- `use` syntactic sugar (weird at first, but once you’re used to it it’s pretty elegant)
- LSP server works great for such a young language
But most of all I think the overall simplicity of the language is really what’s standing out to me. So far I think the lack of ad-hoc poly and macros are a plus - it really reduces the impulse to write “magical” code, or code with lots of indirections. In the past I’ve definitely been guilty of over-abstracting things, and I’m really trying to keep things as simple as possible now. Though I’ve yet to try Gleam with a large project - maybe I’ll miss the abstractions as project complexity increases.
I suspect Gleam will be a great language for small to medium sized projects written with LLM assistance (NOT vibecoded) - the small language, strong typing and immutability gives good guardrails for LLM-generated code, and encourages a simple, direct style of programming where a human programmer can keep the whole structure in their head. Letting an LLM run free and not understanding what it’s written is I think where projects run into big problems.
- packetlost 9mo agoThe use <- syntax is even more crazy when you realize that it's a programmer-friendly way of doing continuation-passing style.
- perrygeo 9mo agoIn a language that is otherwise as simple as it could possibly get away with (no `if`!), `use <-` initially feels like magic and somewhat out of place. But take look at nested callback code, the pyramid of doom, and you see why it's pragmatically necessary. It's a brilliant design that incorporates just enough metaprogramming magic to make it ergonomic. The LSP even lets you convert back and forth between nested callback style and `use`, so you can strip away the magic in one code action if you need to unravel it.
- sureglymop 9mo agoI prefer kotlins trailing lambdas, which do mostly the same. But the way they are written allows code to almost look like JSON/some declarative DSL. But use is nicer to avoid callback hell and all the indentations/scoping.