|
|
|
|
|
by a0
2486 days ago
|
|
One problem with people selling ReasonML's type inference is that it's not depicting the actual developer experience. The first thing to note is that you do interact with types to build a mental model! The editor will show them to you as you move your cursor around the code. It will do that for every single value. Just move the cursor over that `requestContext` argument and voilĂ , it'll show you the type. Another important aspect is that you still have to define types. Have a person object with a bunch of fields? You do have to type annotate every single field. Have multiple actions to handle in reducers? You need to tell ReasonML in advance what those are using a variant type. And finally, if you care about composition/abstraction you should provide interfaces for modules. This requires writing types for all functions explicitly to ensure that you are exposing a correct protocol. This is optional, but it helps both the author of the code and the consumers. Type-inference is just a nice to have feature for the low-level implementation details. |
|