3 ms·
There would still have to be different hardcoded signatures and implementations for cross-product, transformations and "angleTo"-type methods that you would hav
by dougk16 14y ago
There would still have to be different hardcoded signatures and implementations for cross-product, transformations and "angleTo"-type methods that you would have to worry about, depending on how complicated your vector class gets. I don't know if there's really a good way to handle those cases generically. So keeping the classes separate might still make sense, even with that feature.
- onedognight 14y ago> There would still have to be different hardcoded signatures and implementations for cross-product, transformations and "angleTo"-type methods You are right, those are great test cases for Rust. The cross-product takes n-1 n-vectors are returns an n-vector (orthogonal to the n-1 inputs). The transformations are easy to generalize as affine or homogeneous transformations. A nice features of Rust is that it has macros, so once it has dependent types creating these function with different signatures should be straight forward! I'd hope that like C++, you would be able to add in any extra functions you'd need for specific dimensions.