Re:The Unsound Playground: Java and Scala's Type Systems are...
by danarmak on Sunday November 27, 2016 @03:07PM
(#13051177)
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.
[ Parent
| on HN ]
Re:The Unsound Playground: Java and Scala's Type Systems are...
by wtetzner on Monday November 28, 2016 @11:06AM
(#13056255)
It 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.
Re:The Unsound Playground: Java and Scala's Type Systems are...
by danarmak on Tuesday November 29, 2016 @09:23AM
(#13063164)
If 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.
Re:The Unsound Playground: Java and Scala's Type Systems are...
by wtetzner on Wednesday November 30, 2016 @01:33PM
(#13073308)
I 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.