Maybe you could bring any example of such ocaml functionality?
Maybe you could bring any example of such ocaml functionality?
Had to look up to see where Java is at for sum types. First link I found. https://sfietkonstantin.github.io/2021/09/03/Java-sum-type.h...
Also, somehow I rarely have need to use something like that personally.
> And ease of use is important
the question is if insignificant syntax sugar worths switching to unpopular platform with undeveloped toolings and uncertain support.
do you have specific example?
Initially you might think generating HTML tags from data structures in code should be a simple matter. But there are complexities--some tags are defined as having no child tags, others do. Some tags are purely character data (unstructured text), not structured data. Some are just comments. We need a way to compose multiple tags together into a single 'virtual' tag for flexible HTML generation. All these conditions can be pretty hard to keep track of--unless your compiler does exhaustiveness checking. Then the compiler will tell you if you missed any cases.
In the example above I didn't make any manual effort to cover all the cases, I simple listed out the cases I wanted to handle in order. The compiler made sure that I didn't miss any.
Many times compiler tooling will do just fine with good old visitor patterns, enums etc..
Sure there may be small amount of errors missed, but that's not always as critical as availability of libraries and integration.