zlacker

[return to "I tried Gleam for Advent of Code"]
1. threet+16[view] [source] 2025-12-13 17:46:42
>>tymsca+(OP)
It’s really good. But it needs generics. This is a huge downside. It’s a typed and clean functional programming language but it arbitrarily followed golangs early philosophy of no generics. Ironically golang is one of the most hated languages among many fp advocates.

By the developers own action of adding generics ultimately the golang team admits they were wrong or that generics are better. If gleam gets popular I think much of the same will occur.

There’s simply too much repeated code without generics. I tried writing a parser combinator in gleam and it wasn’t pretty.

◧◩
2. akkad3+1e[view] [source] 2025-12-13 18:43:29
>>threet+16
Why does it need generics? There's a great blog post about how you can replace a lot of trait behaviour with just functions. Maybe something like that can be done for generics
◧◩◪
3. riffra+Zt[view] [source] 2025-12-13 20:45:11
>>akkad3+1e
the comment is wrong, what Gleam lacks is interfaces.

Which feels super strange, but doesn't seem to really be a problem, e.g. imagine a language where you'd write

    fun sum_all_numbers(Iterable<T> it) { it.fold(...) } # an interface
    sum_all_numbers(a_list) # a list implements iterable

Gleam wants you to write

    fun sum_all_numbers(Iterator<T> it) { it.fold(...) } # a concrete type
    sum_all_numbers(a_list.iterator) # get the caller to build the right object

edit: found an article that explained this a bit better https://mckayla.blog/posts/all-you-need-is-data-and-function...
◧◩◪◨
4. akkad3+89c[view] [source] 2025-12-17 17:33:49
>>riffra+Zt
Yes this is the article I was referring to. Gleam does not need interfaces or traits because functions can do it
[go to top]