Comment by stuartaxelowen

1 month ago

Does that mean pass every needed function as a parameter? Or just don’t write generic functionality?

Yes, one would use higher order functions, as is common in Erlang, Elixir, OCaml, Elm, etc.

  • At least half of those languages (Elixir and OCaml) have some sort of mechanism for ad hoc polymorphism (elixir has behaviors and protocols, OCaml has higher order modules) so I feel like the comparison doesn't work that well personally

    • OCaml's modules are not implicitly instantiated, so they provide the same DX and APIs as you would get in Gleam.

      Elixir does have protocols, but they are extremely limited compared to type classes, traits, etc, and they're uncommonly used compared to writing concrete code.