3 ms·
I like and agree with his posts, but the last one does feel like a bit of a bait and switch: The first post talks about the difficulty of getting compile time
by larksimian 9y ago
I like and agree with his posts, but the last one does feel like a bit of a bait and switch:
The first post talks about the difficulty of getting compile time errors for Wizard wielding a Sword
The last post completely abandons the notion of statically checking anything about the Weapon assigned to a Player(beyond the most general case of is Player and is Weapon).
I don't actually have enough experience with Erlang/Elixir to know but I thought their function overloading (http://raganwald.com/2014/06/23/multiple-dispatch.html http://raganwald.com/2014/06/23/multiple-dispatch.html) still provides multiple dispatch with compile time checks?
The proposed Rules solution is more elegant to use(for the programmer, if not the person defining the Rules) but it does nothing(or at least very little) to help you check that the business logic is correctly encoded. Yes, you're likely going to avoid your program crashing, but that's just because you've given up on encoding the business logic entirely. At least where compile time checking is concerned.
Maybe I'm expecting too much of the type system and that's the actual lesson of the blog posts.