Porting Math library to Rust


I’ve started a project to port some features of the Math lib to Rust. It’s not intended to be an identical port, but more like proof of concept to try some “rusty” things.




What’s the motivation?

Do they give you a way to implement something like template-based autodiff?


Yes, one can do that using trait. Instead I use enum(rust’s sum type) and pattern matching to implement vari. One can do the same thing using boost::variant but IMO rust is ergonomic-wise easier.


Those variant types in Boost are a huge pain. Just about anything’s going to be easier to use. @seantalts’s plan is to move to a simpler s-expression kind of format where it’s just a string and we just match.

But that’s only in the parser. We don’t really use variant types in the math lib for anything.