Hayden: Louis, thank you for taking the time to speak with me about your work on Gleam, the language has been generating a significant amount of buzz within the Elixir community & I thought it would be great to discuss it in some more detail.
Firstly, would you mind taking a moment to introduce yourself & your background for context?
Louis: Hi Hayden! Thanks for having me.
I’m the creator and lead developer of Gleam, which is a new programming language that also runs on the Erlang virtual machine. Thanks to the runtime it has many of the same strengths as Elixir, and it has excellent interop with Elixir and Erlang, but unlike those languages it also features a powerful static type system similar to the ones found in languages like Elm and OCaml.
As for my background: at university I studied biology but I wasn’t very good at it. After realising that I dropped out and picked up a book on programming, and I’ve been working in various tech companies and on open source code ever since.
Hayden: I’m fascinated by the process involved with creating a whole new programming language from scratch, could you share some insight on the initial steps you took?
Louis: I discovered Elixir just after v1.0 was released. I quickly fell in love with the language but found myself missing some of the tools that I had in other languages, so I started making my own versions. I made the first Elixir linter which René Föhring evolved into Credo, I made the first Elixir formatter, I made a HTML templating language, and a few other things.
After making these I realised they had all the different parts of a compiler- parsing, static analysis, and code generation. I was (and still am) fascinated by programming languages and would try to learn a few new ones every year, so the idea that I could make my own compiler was really exciting! I did the sensible thing and immediately put forward a talk proposal for the Elixir LDN conference on making a BEAM language. It was accepted, so motivated by a desire not to look like a fool on stage I stumbled through making a toy language and presented it at the conference.
I stopped working on the compiler after the talk but the idea that I could make a new language had been planted in my mind. I spent the next 2 years thinking about what my ideal language might look like. I would write small programs in these made-up languages and run them in my head (as I had no compiler for them), just so I could see how different ideas would work and how they would interact with each other. During this time all the key features of Gleam came into focus, and after that I was ready to start implementing the language.
If I could give one tip for making a language it would be to spend as much time using it before implementing it as possible. It’s slow to evaluate a program in your head, but it’s much slower to implement a compiler just to test out a new idea.
Hayden: It’s amazing how this has all sprouted from a presentation. Sounds like everything went relatively smoothly, did you encounter any major challenges along the way?
Louis: There is a real lack of resources for learning about programming language theory and implementation, especially when it comes to type systems. Most books and papers on the subject are dense and use largely unexplained notations that the reader is expected to know from elsewhere. This makes it very difficult to get started.
Compiler development has a bit of a reputation for being difficult, but I think that’s nonsense. I think it’s really no more difficult than web development or game development, but the learning resources are much much worse. If we could improve the learning experience I think we’d have a lot more people contributing to their favourite programming languages, or making their own new ones.
Hayden: Looking back, is there anything that you would have done differently given the opportunity?
Louis: I’m very happy with all the decisions I’ve made with Gleam and how the project is growing, but I do wish I had been able to spend more time on it. I’m fortunate enough to have been able to work full time on Gleam for a good chunk of its existence, but most of the time I’ve had to slot it around other work to pay the bills.
Gleam development is funded through GitHub sponsors, and it has been growing over time. With a few more people and companies sponsoring the project I’ll be able to spend more time on Gleam and less time on unrelated work.
Hayden: When it comes to Erlang there’s often a very specific set of industries that it’s best suited to (Telco, payments, gambling etc..) do you think there are certain domains that would be perfect for Gleam?
Louis: I would say that Gleam is suited to any industry that Elixir or Erlang would be suited to, which I think is most of them. The BEAM languages are excellent general purpose programming languages that’ll work in lots of different spaces.
Gleam might have a slight advantage over Elixir for projects where correctness is important. I know several people and companies are using Gleam to write the core business logic for larger Elixir web services.
Hayden: What’s the problem you were trying to solve when creating Gleam? (vs Elixir) Louis: Gleam comes from my love of two different families of functional programming languages, the Erlang family, and the ML family.
With Erlang based languages I really enjoyed the concurrency model, the fault tolerant approach to errors, and all of the powerful debugging and introspection features that make running Erlang in production that much easier than other languages.
When writing ML languages such as Elm, OCaml, or Haskell I felt like I could re-factor complex and unfamiliar systems with great ease compared to other languages. The compiler was always there to help and show me what I needed to do next. Difficult problems that I would struggle with elsewhere became a lot more achievable with these languages.
Every time I was either of these language families I would find myself missing certain characteristics from the other family. Gleam is an attempt to bring the best of both together, to make a programming experience that is as productive and enjoyable as possible.
Hayden: What would you say has been your biggest celebratory moment since creating the language?
Louis: It was quite a few years back now, but the first time I managed to get the type checker successfully run against some code was a real exhilarating moment. It was quite tricky to learn how to implement the type system, so to succeed felt like a huge milestone.
Hayden: Do you have a wishlist for the language going forward? What can users expect going forward?
Louis: The language itself is more or less done! There's a few small pieces to add but generally it is complete. Now the focus is on tooling, libraries, and documentation. Gleam is all about productivity so the better we can make the experience of learning Gleam and using Gleam the better.
One thing that I am particularly looking forward to is an interactive tutorial that you can access from within your web browser, similar to the one that Go has. Being able to try out the language and start learning it without having to install anything on your computer is really convenient, and I think it will make it a lot easier for people to get started with Gleam.
Hayden: I know some companies have begun to use Gleam in production, which is awesome news! Have you had much feedback from them?
Louis: Yes, it is very exciting! It sounds like they are doing well and all of the feedback I have got back from them is very positive. Occasionally someone finds a code generation bug but so far they've all been a couple of lines of code to fix, nothing troublesome.
I think the most pressing problem that people have is documentation and libraries. Gleam is such a new language that there aren't huge amounts of either, and the better we can do there the more productive Glean should be for its users. Hayden: What’s your elevator pitch for someone that wants to convince their team to try Gleam for a project?
Louis: A tricky one, I really think it depends on the team. There's lots of different reasons one might want to try Gleam, or any new language for that matter.
For general Elixir developers I might say that Gleam is a language that gives you all of the good stuff of the BEAM, works well alongside your existing Elixir code, and gives you a new way of programming where the compiler is trying to help you as much as possible to get your changes done without stress.
Hayden: What would your recommendations be for someone that wants to learn Gleam?
Louis: Drop by the Gleam discord server! There's lots of friendly people in the community who would love to help out with anyone getting started with Gleam.
You could also check out the getting started section of the Gleam website. It will give you a tour of the language that should be enough for you to get started making Glean programs.
Or if you're an experienced Elixir developer and want to get started quickly check out the cheat sheet that shows you how to go from Elixir to Gleam.
Hayden: Brilliant resources, thank you for sharing! Who would you say are your major influences in the tech community?
Louis: I really look up to people who have managed to create friendly, vibrant, and welcoming communities. Elixir's very own José Valim is a standout example of someone who has really succeeded here. The Elixir community is fantastic and I'm very happy to be part of it. I hope that Glean's community will be just as energetic and wonderful as the Elixir one in future.
Hayden: Is there any other tech you’re particularly excited about at the moment?
Hayden: Thank you so much again for taking the time to collaborate with me on this interview, before we go I’ll finish up with the question I ask every one of our experts… What would you tell your Elixir beginner self?
Louis: Keep going past Louis! The BEAM is fantastic and it is going to change how you think and feel about programming. Be ambitious and have fun!