Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement operator overloading symmetrically #400

Open
HalfVoxel opened this issue Feb 24, 2020 · 2 comments
Open

Implement operator overloading symmetrically #400

HalfVoxel opened this issue Feb 24, 2020 · 2 comments

Comments

@HalfVoxel
Copy link

HalfVoxel commented Feb 24, 2020

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
Copy link
Contributor

nical commented Feb 25, 2020

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

@nical
Copy link
Contributor

nical commented Jul 20, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants