August 31st, 2024

Shine with Gleam

Rocky Jaiswal, with 22 years of programming experience, praises the Gleam language for its functional programming features, simplicity, and efficiency, despite some challenges in handling nested results.

Read original articleLink Icon
Shine with Gleam

Rocky Jaiswal reflects on his extensive programming experience and shares his enthusiasm for the Gleam programming language, which he believes aligns with his preferences for functional programming. He emphasizes the importance of separating code and data, advocating for a functional style that utilizes immutable data and small, composable functions. Jaiswal critiques object-oriented programming for its complexity and difficulty in debugging, preferring a clear and confident approach to coding. He outlines his ideal programming environment, which includes support for structured concurrency, strong type systems, and effective testing tools. Jaiswal appreciates Gleam for its simplicity, built-in features, and ability to handle tasks like file parsing and HTTP requests efficiently. He demonstrates this through a project that identifies the hottest city from a list by leveraging Gleam's functional capabilities. Despite some challenges, such as handling nested results, he finds the language expressive and readable. Jaiswal acknowledges that while Gleam is not without its imperfections, it offers a promising avenue for exploring functional programming in a modern context.

- Rocky Jaiswal has 22 years of programming experience and enjoys exploring new tools and languages.

- He prefers functional programming over object-oriented programming for its clarity and ease of debugging.

- Jaiswal finds Gleam to be a suitable language that meets many of his programming preferences.

- He demonstrates Gleam's capabilities through a project that processes city temperature data.

- Despite some challenges, he views Gleam as a promising language for future exploration.

Link Icon 12 comments
By @davedx - 4 months
Great programming lang article, starts with premises then shows examples, iterations, and final words. Gleam looks really interesting, though personally I’ll stick with TypeScript because it’s “good enough” and I understand where mutability can sneak in sometimes well enough these days.
By @oDot - 4 months
I rewrote my webapp, Nestful[0], in Gleam.

I use it in Vue components with Vleam[1]. About half of the frontend is rewritten at the moment, and it is a joy to use.

I'd do it again just for the error handling.

[0] https://nestful.app

[1] https://github.com/vleam/vleam

By @zeroc8 - 4 months
I'm currently a Java developer working on a large code base. This is where Java's object oriented nature really shows its weaknesses. Reading other people's code becomes a huge pain, since everything is mutable and you can never be sure what state your program is in after a function call. Even C++ is better in that regard, at least you can pass values by copy or const reference. Gleam looks really nice at first glance. The problem of course is, as long as there is no industry support, it doesn't make sense to invest into it. It may be ok for small side projects, but I wouldn't dare starting a major application in something like that. Sooner or later you come across something you need and there is no library for it. Then you are forced to start messing around with FFI and whatnot.
By @k__ - 4 months
Half-OT: Is there any effort on getting BEAM on WebAssembly? There was Lumen/Firefly, but the repo got archived a few months ago.
By @widdershins - 4 months
> the "flattening" above seems unnecessary but I could not avoid it since "Result#map" wraps the Result in another Result (I could not find a flat_map).

In Gleam, this is called `result.try`[1]

[1] https://hexdocs.pm/gleam_stdlib/gleam/result.html#try

By @WuxiFingerHold - 4 months
A perfect hands-on introduction. Gleam is on the paper the "Simpler Rust". Yet very powerful. But it's so incredible hard to become relevant in the programming language world. As others have said: Typescript (esp. with Deno) is not that bad. Yes, error handling is miles away from Gleam, but is this enough for people to make the switch?
By @victorbjorklund - 4 months
As an elixir developer I'm so jealous at Gleam (but stay with Elixir because ecosystem and phoenix)
By @jroesner - 4 months
As always put together perfectly. Not only fun to read, but also a new item on my todo list.
By @dxxvi - 4 months
It seems to me that Scala has all the features that Gleam has. And they both run in VM's. Scala is not very popular and Gleam is less popular that that. Someone must really love learning a new language to learn Gleam. I respect it very much.
By @sureglymop - 4 months
Gleam is great. I think adoption will highly depend on developer tooling, LSP, ide integration etc.

The experience is alright now but it has to get better to go mainstream (if that's even desired). If I had time I'd love to contribute.

By @28304283409234 - 4 months
From https://gleam.run :

> Black lives matter. Trans rights are human rights. No nazi bullsh*t.

I agree, but I do not agree with painting people that disagree as 'Nazi'.

*edit: that quote was from the Gleam website, not the website linked.