kvark / mint

Math Interoperability Types
MIT License
256 stars 20 forks source link

Implement `Add` and `Sub` #75

Closed sanbox-irl closed 1 year ago

sanbox-irl commented 1 year ago

Hello!

I'm working on a library called tween and I cant use Mint if it doesn't implement Add and Sub. I know that Mint isn't a math library, and i suspect that add and sub aren't implemented to make it very clear that no operations are performed by mint, but these are simple, basic operations, which have obvious implementations.

In my library, I need certain T to impl Add and Sub. I could instead use methods add and sub, but...welll...there's a reason we don't do that in general in Rust! It makes the code extremely unreadable.

Right now, I support 4 math libraries. I'd like to, basically, not, and only support mint and do conversions for users instead.

Thank you!

kvark commented 1 year ago

Hi! Mint is intentionally not supporting any math operations. It's pure interop. If your library is generic over T and bound by Add and Sub, then it already has a nice idiomatic API and it doesn't need mint on the interface. It should just expect to work with real math types instead.