3 ms·
I don't understand this post at all. He started with wanting compile time validation of the invariant ("A wizard cannot wield a sword") - then talked about how
by inglor 11y ago
I don't understand this post at all. He started with wanting compile time validation of the invariant ("A wizard cannot wield a sword") - then talked about how runtime solutions were not good and then ended up with a solution that does not verify that invariant in compile time at all.
He just ended up with a language where all code is written in a specific language programmers have to learn and errors are in another language.
The generic constraint solution he had in the middle (part 2) was actually pretty decent because hey: if Wizards and Warriors can't yield the same weapons - and the weapon is a property of the supertype then __they are not interchangeable as players__. You need a different interface.