TrackMate icon indicating copy to clipboard operation
TrackMate copied to clipboard

Increase the usage of compound assignment operators

Open elfring opened this issue 2 years ago • 2 comments

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of compound operators accordingly.

Would you like to integrate anything from a transformation result which can be generated by a command like the following? (:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)

lokal$ perl -p -i.orig -0777 -e 's#\b(?<target>\S+)\s*=\s*\k<target>[ \t]*(?<operator>[+\-*/%^]|&(?!&)|\|(?!\|)|<<|>>>?)#$+{target} $+{operator}=#gm' $(find ~/Projekte/TrackMate/lokal -name '*.java')

:crystal_ball: How will development interests evolve further also according to update candidates in 142 lines of this software?

elfring avatar Dec 13 '21 20:12 elfring

Hello @elfring I don't know what this could bring. Could you elaborate?

tinevez avatar Jun 07 '22 19:06 tinevez

:thought_balloon: I suggest to take another look at consequences according to the following information from the Java language specification.

“… A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2)), where T is the type of E1, except that E1 is evaluated only once. …”

elfring avatar Jun 08 '22 18:06 elfring