Issue Details (XML | Word | Printable)

Key: GROOVY-635
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Edward Povazan
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Overloading divide - method is called "div" not "divide"

Created: 17/Sep/04 04:35 PM   Updated: 24/Jun/07 05:47 AM
Component/s: class generator
Affects Version/s: 1.0-JSR-1
Fix Version/s: 1.1-beta-2

Time Tracking:
Original Estimate: 10 minutes
Original Estimate - 10 minutes
Remaining Estimate: 10 minutes
Remaining Estimate - 10 minutes
Time Spent: Not Specified
Remaining Estimate - 10 minutes


 Description  « Hide
The documents describe overloading the divide operator as adding method divide() to a class.
It is in fact div(). I see this in AsmClassGenerator and AsmClassGenerator2 (not sure where else it needs to change)

For consistency the methods should either be mul() and div() or multiply() and divide(). At the moment they are multiply() and div().



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brian Larson added a comment - 18/Jan/05 08:55 AM
div() was chosen to avoid a conflict with BigInteger.divide(). Other methods are consistent with Groovy and therefore do not conflict.

Guillaume Laforge added a comment - 18/Jan/05 09:07 AM
In a former IRC log session, James decided we should use special method names for method operators (especially for method overloading). All operator methods should be called g$add(), g$xxx(), etc.

We may end up using a particular syntax on the Groovy side, like:

operator + (...) {...}


Paul King added a comment - 24/Jun/07 05:47 AM
Documentation has been fixed at some point in the past.