4 ms·
To be fair, in OCaml, Haskell or Rust the type "A | B" also had to be declared beforehand.
by rixed 5y ago
To be fair, in OCaml, Haskell or Rust the type "A | B" also had to be declared beforehand.
- deleted 5y ago[deleted]
- carlmr 5y agoYes, but it doesn't really change the way you could handle it, and what I wanted to point out is that it actually helps with type safety, enabling you to create total functions.
- Zababa 5y agoNot exactly. For example, in Rust, you can do unions for traits: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=81fb8e831abf5df84944c54c25c562d6 https://play.rust-lang.org/?version=stable&mode=debug&editio.... OCaml has the same system for its objects, where objects are structurally typed.