4 ms·
If F# had taken OCaml's module system, functors would be the obvious way to do dependency injection, and would have been supported out-of-the-box. I realize th
by wtetzner 8y ago
If F# had taken OCaml's module system, functors would be the obvious way to do dependency injection, and would have been supported out-of-the-box.
I realize there were difficulties in integrating with the rest of the .NET platform/ecosystem, but it's really too bad that the module system was left out, as it's one of the best parts about OCaml.
- deleted 8y ago[deleted]
- Nelkins 8y agoWhat can you achieve using OCaml modules that you can't do using objects with a constructor in F#?
- wtetzner 8y agoThere are a few advantages of modules. One is that they can encapsulate types along-side functions/values. Also, it can be advantageous that functors are applied at compile time. The really cool one though is abstract types. You can distinguish types purely in the type system, with no change to run-time representation, using module signatures that don't specify the concrete type of a type entry.