Hacker News new | ask | show | jobs
by exo-cortex 664 days ago
Just one thing (maybe the author reads this):

The nicest way to avoid the "oh a lot of boilerplate!"-problem with implementing "Add" for a custom type is by using the "derive-more"-crate. Then you simply put a "#[derive(Add)" above your struct. That was the initial reason I switched to Rust myself: because I was writing a dynamical systems solver in C++ and had to overload arithmetic operators for my state-struct. But doing this was so complicated and I never felt sure of it performance wise (what if one side is a reference? And so on).

In rust I have a macro and don't have to ever worry about that again.

1 comments

Author here!

Oh, that's a neat crate, I'll check it out.

I'd be interested to see if you have benchmarks of your dynamical systems solver in Rust vs the ones implemented in Julia. They've done great work!

> Linear Algebra and numerics where not a primary focus of Rust when starting out as they were with Julia.

Typo: where -> were

Thanks! Fixed.