zlacker

[return to "I tried Gleam for Advent of Code"]
1. mono44+gg[view] [source] 2025-12-13 19:05:07
>>tymsca+(OP)
I've looked at Gleam before but it didn't seem to have any mechanism for dynamic dispatch like interfaces or type classes. Did it change in the meantime?
◧◩
2. lpil+Ih[view] [source] 2025-12-13 19:18:36
>>mono44+gg
Gleam has first class functions, so it has dynamic dispatch.

Both of type classes and interfaces desugar to high order functions, so anything you write with them can be written with first class functions, though with a less concise API.

◧◩◪
3. the_du+6i[view] [source] 2025-12-13 19:21:13
>>lpil+Ih
What you are saying is: no, it doesn't.

Of course dynamic dispatch can be implemented in almost every language. The Linux kernel uses dynamic dispatch with C!

But that's a hack, not a language feature.

◧◩◪◨
4. lpil+Di[view] [source] 2025-12-13 19:24:59
>>the_du+6i
I think you might mean “ad hoc polymorphism” rather than “dynamic dispatch”. Gleam, C, Erlang, etc have the latter, not so much the former.
[go to top]