Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
rixed
4y ago
0 comments
Share
To be fair, in OCaml, Haskell or Rust the type "A | B" also had to be declared beforehand.
0 comments
default
newest
oldest
Zababa
4y ago
Not exactly. For example, in Rust, you can do unions for traits:
https://play.rust-lang.org/?version=stable&mode=debug&editio...
. OCaml has the same system for its objects, where objects are structurally typed.
carlmr
4y ago
Yes, 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.
j
/
k
navigate · click thread line to collapse