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

Reverse binary operator overload #25

Closed
amelentev opened this Issue Oct 21, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@amelentev
Owner

amelentev commented Oct 21, 2014

Use case - multiply double to Complex:

Complex a = new Complex(1.2, 2.3)
1.2*a

We can't add method multiply to double.

Solution:
add method Complex#multiplyRev(double)
This method will be used on second operand in cases where is no multiply method in left operand.
So: 1.2 * a will be transformed to a.multiplyRev(1.2)
This should work for every binary operator.

@amelentev

This comment has been minimized.

Show comment
Hide comment
@amelentev

amelentev Dec 1, 2014

Owner

Implemented in JavaC7,8-oo-plugin 0.5, idea-oo-plugin 0.4

Owner

amelentev commented Dec 1, 2014

Implemented in JavaC7,8-oo-plugin 0.5, idea-oo-plugin 0.4

@yuemingl

This comment has been minimized.

Show comment
Hide comment
@yuemingl

yuemingl Jan 2, 2015

That's really useful!

yuemingl commented Jan 2, 2015

That's really useful!

amelentev added a commit that referenced this issue Jan 22, 2015

@amelentev

This comment has been minimized.

Show comment
Hide comment
@amelentev

amelentev Jan 27, 2015

Owner

Implemented in eclipse-oo-plugin 0.5

Owner

amelentev commented Jan 27, 2015

Implemented in eclipse-oo-plugin 0.5

@amelentev amelentev closed this Jan 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment