News for hackers. Stuff that matters.
Re:Inheritance Often Doesn't Make Sense by jdmichal on Monday March 19, 2018 @01:19PM (#16620393)
Sum types! I don't get to use that kind of stuff very much, so I tend not to think about them off the top of my head :)

How do languages with sum types handle scenarios where the type is A+B, but B is a subtype of A? So you're really guaranteed to have an A, but you may or may not have a B? Do they allow transparent reference as type A, or must you disambiguate first?

That is, given a function that takes an A, can you pass it a type A+B, given that B is a subtype of A?

There are no comments on this comment yet.