What I find very fun about Gleam is its minimalism. You've got functions, types, a case expression, and modules to organize them. That's it. No inheritance, no methods, no ifs, no loops, no early returns, no macros. And yet it's fairly productive and ergonomic to write.
For the most part, Gleam feels like it has gathered the best ideas from some interesting langs (perhaps a chimera of Rust, Go, ML and Lisp) and put them into one coherent, simple language. It's not that the ideas are new, they're just very well organized.
Gleam's labelled arguments are AFAIK a unique feature. (Edit: Nope see comments below) This lets you have named function argument appear differently to the caller than they do internally. The caller may way to refer by verb ("multiply_by") and the function may want to refer to it as a noun ("multiplier").
The `use <- ...` expression and pipeline operator `|>` can reduce boilerplate with nested function calls in a lot of cases. It's a nod to the ergonomic benefits of metaprograming without giving the user a full macro system.
Finally Gleam's tooling is the best in the business, hands down. The entire language, the compiler, package manager, LSP, etc, is all built into a single binary with an ergnomic CLI. Compared that to cobbling together a python environment or pretty much any other language where you need to assemble and install your own piecemeal toolkit to be productive.
> Gleam's labelled arguments are AFAIK a unique feature
OCaml also does this:
# let foo ~bar:baz = baz + 42;;
val foo : bar:int -> int = <fun>
# foo ~bar:12765;;
- : int = 12807
What I really enjoyed was its parameter forwarding, which is available in some languages for records:
# let bar = 42;;
val bar : int = 42
# foo ~bar;;
- : int = 84
Works similarly for optional values:
# let test ?(arg=5) () = arg;;
val test : ?arg:int -> unit -> int = <fun>
# let arg = None;;
val arg : 'a option = None
# test ?arg ();;
- : int = 5
And if you used ~arg, it would be a non-optional parameter:
# let arg = 5;;
val arg : int = 5
# test ~arg ();;
- : int = 5
Overall pretty spiffy. Partial application also works here nicely, but it does cause some trouble with optional arguments :/. For example, here "test" needs to have a final argument () so the optional parameter can be erased:
# test;;
- : ?arg:int -> unit -> int = <fun>
# test ();;
- : int = 5
> Gleam's labelled arguments are AFAIK a unique feature. This lets you have named function argument appear differently to the caller than they do internally. The caller may way to refer by verb ("multiply_by") and the function may want to refer to it as a noun ("multiplier").
I think it is pretty much just ML on the beam? It resembles rust and go maybe in the ways that they have also been influenced by ML. The syntax is fairly C-like which I guess resembles rust more than ocaml but I think that's surface level. I don't know rust or go but I don't see any concepts in gleam that aren't familiar either from ocaml or erlang.
Lisp I don't see it at all, except treating functions as entities in their own right, which is a nearly universal language feature at this point and doesn't ring as particularly lispish to me anymore.
IMO the design is extremely similar to elm. It feels like the author wanted elm but instead of targeting frontend+javascript, it targets beam+backend. It also seems to make very similar tradeoffs to OCaml.
Which is great, because elm is probably the best programming language I've ever used.
For the most part, Gleam feels like it has gathered the best ideas from some interesting langs (perhaps a chimera of Rust, Go, ML and Lisp) and put them into one coherent, simple language. It's not that the ideas are new, they're just very well organized.
Gleam's labelled arguments are AFAIK a unique feature. (Edit: Nope see comments below) This lets you have named function argument appear differently to the caller than they do internally. The caller may way to refer by verb ("multiply_by") and the function may want to refer to it as a noun ("multiplier").
The `use <- ...` expression and pipeline operator `|>` can reduce boilerplate with nested function calls in a lot of cases. It's a nod to the ergonomic benefits of metaprograming without giving the user a full macro system.
Finally Gleam's tooling is the best in the business, hands down. The entire language, the compiler, package manager, LSP, etc, is all built into a single binary with an ergnomic CLI. Compared that to cobbling together a python environment or pretty much any other language where you need to assemble and install your own piecemeal toolkit to be productive.
Very excited to try Gleam more.