| ▲ | threethirtytwo 13 hours ago |
| 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. |
|
| ▲ | lpil 12 hours ago | parent | next [-] |
| Gleam has always had generics! There’s no Gleam version without them |
|
| ▲ | nonethewiser 12 hours ago | parent | prev | next [-] |
| Go touted it's lack of features as simplicity. And it is: on the language writing side. Go is an incomplete language masquerading as a simple one. |
| |
| ▲ | ljlolel 12 hours ago | parent [-] | | That’s the worse is better philosophy which maybe doesn’t matter as much anymore especially with AI | | |
| ▲ | NuclearPM 11 hours ago | parent [-] | | What do you mean? | | |
| ▲ | array_key_first an hour ago | parent [-] | | I think he means maybe AI can get around languages lacking features - like how codegen was used for a long time. Codegen is more and more rare these days, because languages have so many tools to help you write less code - like generics. LLMs could, theoretically, help you crank out similar repetitive implementations of things. |
|
|
|
|
| ▲ | kace91 13 hours ago | parent | prev | next [-] |
| Perhaps this is a silly question but how do you do functional with no generics? Arent they pretty much required for map/reduce/filter? |
| |
| ▲ | threethirtytwo 13 hours ago | parent | next [-] | | Sorry my comment was wrong. It’s been a while when I messed with gleam and I remember it was missing a critical thing but I misremembered what it was. Gleam doesn’t support interfaces. Not generics. You are completely right. | |
| ▲ | chongli 12 hours ago | parent | prev | next [-] | | There are multiple levels of possible generics at play here: the container type and the element type. You can have a map/reduce/filter that operate on any element type (generic elements) while still being specialized to linked lists. On the other hand, you might prefer a generic map that can operate on any container type and any element type, so that you can use the same map method and the same function to map over arrays of numbers, sets of numbers, lists of numbers, trees of numbers, or even functions of numbers! Haskell allows both sorts of generics. In Haskell parlance they call this higher-kinded polymorphism and the generic version of map they call fmap (as a method of the class Functor). | |
| ▲ | lpil 12 hours ago | parent | prev | next [-] | | Gleam does have generics. | |
| ▲ | nerdponx 11 hours ago | parent | prev [-] | | Most Scheme implementations don't have generics, and you have to deal with a different map function for every data structure. Gauche has a generic sequence interface which is great, and it's one of the reasons as a Python user I like Gauche as my "daily driver" Scheme. |
|
|
| ▲ | NathanaelRea 13 hours ago | parent | prev | next [-] |
| I saw your other comment that you meant interface. But an example of a language that went without a feature people thought the language desperately needed was Go with generics. They only added them more than ten years later, when they figured out the best way to implement them. It might be the same with gleam, with first version in 2019 and 1.0 in 2024. The language authors might think they are either uneeded and lead to anti patterns, or are waiting to see the best way to implement them. |
|
| ▲ | akkad33 12 hours ago | parent | prev [-] |
| 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 |
| |
| ▲ | riffraff 10 hours ago | parent [-] | | 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... |
|