News for hackers. Stuff that matters.
Re:Type erasure and reification by skybrian on Wednesday December 05, 2018 @01:33PM (#18611041)
Haskell implementations typically pass around dictionaries at runtime when you use type classes. Since there is one per instance, this could be thought of as a form of type reification.

https://www.schoolofhaskell.com/user/jfischoff/instances-and...

Re:Type erasure and reification by 0db532a0 on Wednesday December 05, 2018 @03:49PM (#18612382)
I don't agree that this is type reification. The dictionaries are resolved at compile time. They may indeed be passed to a function at run-time, but they are not exposed to the user. They are simply a compile-time substitution of abstract function invocations with the implementations according to the chosen type. For actual reification of types in Haskell, you can look at Haskell's Data.Typeable library.
Re:Type erasure and reification by skybrian on Wednesday December 05, 2018 @04:45PM (#18612917)
Well, it's an internal data structure needed at runtime that corresponds to a type, which seems close enough for a rough analogy. But I agree that it's not a language feature.
Re:Type erasure and reification by int_19h on Wednesday December 05, 2018 @05:09PM (#18613152)
It depends on whether you're looking at it from the implementation perspective, or from language user perspective. To the implementation, a dictionary carrying type information (or anything derived from that, such as e.g. method dispatch tables) at runtime is type reification.
Re:Type erasure and reification by 0db532a0 on Wednesday December 05, 2018 @06:51PM (#18613975)
The concept of reification exists only in the context of a chosen language and its universe of objects, and it doesn't extend to the language's implementation. Given the language Haskell and its universe of objects, Data.Typeable provides a reification of Haskell's types into physical objects inside that universe. The type class dictionaries are not physical objects inside this universe.
Re:Type erasure and reification by naasking on Thursday December 06, 2018 @01:34AM (#18615912)
By that argument, a Java object's methods are also resolved at compile time.
Re:Type erasure and reification by 0db532a0 on Thursday December 06, 2018 @10:39AM (#18618888)
I didn't structure my reply very well. I didn't mention the fact that the dictionaries are resolved at compile time as a contradiction to anything.