Home Links Blog About
# A Gleam of Hope

###### Mar 12, 2024

So I went and learned a new (programming) language. And I even went so far as to replace the backend of this website with it.

It's a curious thing. I _[previously wrote](https://dneaves.com/blog/2)_ about debating on languages.

- I wanted Elm's strong type system and lack of errors in a backend language.
- So I tried to make Python be that, but I was trying to make it something it wasn't.
- So I learned Haskell, since it's syntactically similar. And as great as it can be:
  - It is simultaneously extremely verbose and often confusing.
  - There are lots of functions that have the option of crashing/failing, leading to more error try/catching like Python.
  - Also, symbols with mystery meanings are great (/s).
- I've been putting off learning Rust, but due to Tauri, I sorta have to.
- I've been slowly creating a parser for my own language.

### Insert **[Gleam](https://gleam.run/)**

This came out of nowhere for me, but there was an announcement for Gleam's 1.0.0 release [on Lemmy](https://programming.dev/post/11029067) that brought it up to me. Looking at it, it was pretty much exactly what I wanted, sans a nit-picking thing I'll get to later.

Gleam looks like Rust, if Rust wasn't nearly as complicated.
Gleam has functional-piping.
Gleam has strong typing.
Gleam has immutability.
Cases over "if-blocks" (Which, since diving into functional programming, it stopped making sense that Booleans had a dedicated block construct when you can just switch/match/case it).
Simple syntax.
No mystery symbols.
Only intentional crashing (I think).
CLI has a dedicated formatter. Also artifact clean-up.
[It also has a cute lil star mascot!](https://gleam.run/images/lucy/lucy.svg)

### Now the _one_ thing I don't like

There is a curious syntax in Gleam called "`use`". It looks [like this](https://tour.gleam.run/advanced-features/use/).

Now, from learning Haskell, seeing backpass-arrows makes me think of IO operations, where you're technically assigning the result of the IO operation to the name on the left (example" `thisFile <- Yaml.decodeFileEither "./file.yaml"` assigns the result of `Yaml.decodeFileEither "./file.yaml"` to the binding name `thisFile`)

I _think_ this is doing the same thing, but without the IO part, and the left hand side is supposed to be the "argument names for the callback function"?

Or apparently you can just not give it a name on the left side, if that applies. Which is if the callback requires no arguments. I understand the words and not the implementation.

### No-Opinion Matters

Gleam is not a "pure" language. Side-effects can occur, probably due to the underlying language(s) structures. This is sort-of minor, but something of note. I understand this one, since it is kinda both a functional and imperative language. I think this is fine, given the fact that it's immutable, so at-most it should be terminal things, reading/writing files, basic IO stuff I'd expect from Python.

I guess I am going to identify as a [Gleamlin](https://gleam.run/frequently-asked-questions/#what-are-gleam-programmers-called) now, too.

### Conclusion

I think I like Gleam. Or, I like it enough where I'm going to try and build everything I can using it, within reason. I also picked it up very quickly, due to the intended lack of complexity of the language. So we'll see where this goes. Let me know [on socials](https://dneaves.com/links) if you have any opinions on Gleam, opinions on this post, or I guess just any opinion at all.