by adamrezich · 2y ago · 0 comments
[0] https://www.ocamlwiki.com/index.php?title=Enums_in_OCaml
But way more important: this OCaml wiki is an AI generated mess full of, well, bullshit. https://discuss.ocaml.org/t/whats-up-with-ocamlwiki/13605
... and now that you mention it, I do remember the variants terminology, esp. around the polymorphic variants feature. It's been 20+ years since I used OCaml, I'm afraid...
Edit: I guess if you've never seen that this is, uh, controversial. Or something. Anyway, Java enums are full-strength classes, look at the planet example here https://docs.oracle.com/javase/tutorial/java/javaOO/enum.htm...
This is more like a Rust enum than a C one, I think you'll find.
It's not clear why Rust got confused.
https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...