[swift-evolution] Epic: Typesafe calculations
2th at gmx.de
Tue Jan 12 15:29:48 CST 2016
> With the proposal it should be possible to write
> func<T, rows1, cols1, rows2, cols2 where cols1 == rows2>(lhs: Matrix<T, rows1, cols1>, rhs: Matrix<T, rows2, cols2>) -> Matrix<T, rows1, cols2>
Wait, I miss a "*" in the signature ;-) — but yes, this is one major goal.
I'm just not sure if it's clever to actually write down the whole example (vector math looks scary to some people — maybe it's better to simply say "you can do it" ;-)
The tiny example should only illustrate how the parameters can be used inside the type. It might be a good idea to show how it's possible to do solve some real world problems like applying a force vector to an object with a given impulse… (if I remember right, there's a thread started by a teacher who uses playgrounds in class — I guess I'll ask him for support).
More information about the swift-evolution