4 ms·
Constructs like Lisp's CLOS and dd hoc polymorphism can provide the same benefit. You don't need a class/trait/etc enforcing a contract on data. Instead you ca
by jghn 4y ago
Constructs like Lisp's CLOS and dd hoc polymorphism can provide the same benefit.
You don't need a class/trait/etc enforcing a contract on data. Instead you can keep data and functionality separate, and then prove you have an implementation of function X for data Y.
This also allows for easy extension of the data downstream.
- Joker_vD 4y agoBut Gleam is statically typed, you see, and very restrictively. In such languages, typeclasses/interfaces/extensible records/(void*)-passing and -casting shenanigans are the things that traditionally provide the virtual/dynamic dispatch to the programmers.