3 ms·
If you look at this from an "expression problem" point of view, this version with the records-of-functions is very similar to OO programming. But without inheri
by ufo 12y ago
If you look at this from an "expression problem" point of view, this version with the records-of-functions is very similar to OO programming. But without inheritance, classes and so on.
- tel 12y agoI'm very much a fan of that POV. I think OO has a lot of mythology, but the technology is relatively similar to something like OCaml or Haskell. Classes are essentially just functions which return "structures". Inheritance and open-recursion/dynamic binding are usually what remain. I'm not terribly sure I miss them.
- lpw25 12y agoIndeed classes are great for these kinds of encodings. It is one of the use cases for which classes are the nicest approach in OCaml. For example, see this section of Real World OCaml: https://realworldocaml.org/v1/en/html/classes.html#open-recursion https://realworldocaml.org/v1/en/html/classes.html#open-recu...