Luke Bemish created GROOVY-10735:
------------------------------------

             Summary: Overloading assignment-and-arithmetic operators 
separately from arithmetic operators
                 Key: GROOVY-10735
                 URL: https://issues.apache.org/jira/browse/GROOVY-10735
             Project: Groovy
          Issue Type: Improvement
          Components: Compiler
    Affects Versions: 4.0.4
            Reporter: Luke Bemish


Groovy allows overloading arithmetical operators (+, *, -, etc.); however, this 
overloading behavior does not allow for an ease of expression of operations 
which ought to mutate the original object. For instance, I might have a Matrix 
class that, for performance reasons, ought to be mutated at times instead of 
constructing a new matrix every operation. Currently, there is no way to 
overload the "+=" operator to tell Groovy that, instead of constructing a new 
object using my overload of "plus", it should instead use some other overload 
for "addition and assignment". This results in either not being able to use 
operator overloads, or a performance impact from the creation of new mods.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to