Using types to keep yourself honest

A very interesting post on design and Swift language features. The problem is to represent a Matrix and support the multiply operation on matrices. Starting with the simplest solution but then trying to find the right way to make sure that compilation will fail if 2 matrices can’t be multiplied.