3 ms·
Even without full-blown reflection, the problem is that you don't have an "is instance of" operation for unerased types. Which is crucial to case/match as used
by danarmak 10y ago
Even without full-blown reflection, the problem is that you don't have an "is instance of" operation for unerased types. Which is crucial to case/match as used in Scala and functional programming in general.
- wtetzner 10y agoIt is not crucial for functional programming, unless your functional programming language uses types as variant tags. Both Haskell and OCaml use type erasure, and I doubt anyone would claim they aren't functional languages.
- danarmak 10y agoIf they store a variant tag, that means they don't erase the bit of info that's needed for case matching. My point is that it's crucial to be able to tell at runtime to which (sub)type a value belongs. Other type information that isn't necessary for that can still be erased.
- wtetzner 10y agoI think we're in agreement, and just tripping over terminology. In most functional languages, values in a variant are just values in that variant. They don't each have their own type, which means the variant tag isn't actually type information.