|
|
|
|
|
by 9rx
68 days ago
|
|
> Go unwillingness to add even the most simple enum kind of type. Go has enums, under the iota keyword. But I imagine you are really thinking of sum types. Technically Go has those too, but must always have a nil case, which violates what one really wants out of sum types in practice. Trouble is that nobody has figured out how to implement sum types without a nil/zero case. That is why you haven't seen a more well-rounded construct for the feature yet. This is not an unwillingness from the Go team, it is more of a lack of expertise. Granted, it is an unwillingness from those like yourself who do have the expertise. What stops you from contributing? > It just takes away so, so many bugs you would normally see in production code. What bugs do you imagine are making it to production? Each pattern matched case has a behaviour that needs to be tested anyway, so if you missed a case your tests are going to blow up. The construct is useful enough that you don't need to oversell it on imagined hypotheticals. |
|
I know fo is not (i dont want it to be) like ocaml, bit any modern language should have some of the basic safety features baked in.