servo/euclid

Implement operator overloading symmetrically

HalfVoxel opened this issue · 2 comments

Several operators do not work when switching the order of the arguments, which makes writing code tedious.

// Compiles
let a = point(1.0, 1.0) * 5.0;

// Does not compile
let a = 5.0 * point(1.0, 1.0);

It seems like a limitation in rust prevented this from being implemented a few years ago. However afaik this limitation has been lifted.

Is there any reason the symmetrical traits have not been implemented yet?

nical commented

No particular reason (I didn't know a restriction had been lifted).

nical commented

It's still not quite clear to me how to implement this. Do you want to give it a go ?