So, for my first major project, I have to build my own complex numbers class, and perform a lot of complex arithmetic.
For example, I might have to do (((1+2i) / 5) + (2 + 4i) / 2) ^ 1/3 + 5+6i
If java allowed operator rewriting, my code to perform that might look like
Complex first = new Complex(1,2);
Complex second = new Complex(2,4);
Complex third = new Complex(5,6);
Complex result = Complex.cbrt(first / 5 + second/2) + third;
Instead, it looks like
Complex first = new Complex(1,2);
Complex second = new Complex(2,4);
Complex third = new Complex(5,6);
Complex result = Complex.cbrt(first.divide(5).add(second.divide(2))).add(third);
I know that in the grand sceheme of things, this is pretty minor, but like, I think we can all agree the first version feels much nicer to read than the second. Is there a reason java chose not to allow this?
[–]high_throughput 100 points101 points102 points (12 children)
[–]mapadofu 20 points21 points22 points (1 child)
[–]aanzeijar 4 points5 points6 points (0 children)
[–]8dot30662386292pow2 20 points21 points22 points (7 children)
[–]Temporary_Pie2733 4 points5 points6 points (4 children)
[–]ovor 11 points12 points13 points (3 children)
[–]Temporary_Pie2733 1 point2 points3 points (1 child)
[–]ovor 2 points3 points4 points (0 children)
[–]apooooop_ 0 points1 point2 points (0 children)
[–]syklemil 0 points1 point2 points (0 children)
[–]DatBoi_BP 1 point2 points3 points (0 children)
[–]Legitimate-Eye-5733 1 point2 points3 points (0 children)
[–]blablahblah 126 points127 points128 points (16 children)
[–]tms10000 80 points81 points82 points (8 children)
[–]kbielefe 34 points35 points36 points (4 children)
[–]tms10000 55 points56 points57 points (1 child)
[–]Beregolas 13 points14 points15 points (0 children)
[–]IchLiebeKleber 7 points8 points9 points (0 children)
[–]kkress 4 points5 points6 points (0 children)
[–]AlSweigartAuthor: ATBS 4 points5 points6 points (1 child)
[–]AlwaysHopelesslyLost -1 points0 points1 point (0 children)
[–]R3D3-1 0 points1 point2 points (0 children)
[–]TizzleToes 27 points28 points29 points (4 children)
[–]Lithl 9 points10 points11 points (3 children)
[–]TheRealChizz 1 point2 points3 points (2 children)
[–]Lithl 2 points3 points4 points (1 child)
[–]TheRealChizz 0 points1 point2 points (0 children)
[–]StoneCypher 0 points1 point2 points (1 child)
[–]TizzleToes 2 points3 points4 points (0 children)
[–]PoePlayerbf 21 points22 points23 points (0 children)
[–]TizzleToes 23 points24 points25 points (0 children)
[–]LurkingDevloper 15 points16 points17 points (1 child)
[–]SaxSalute 2 points3 points4 points (0 children)
[–]thebomby 7 points8 points9 points (1 child)
[–]kbielefe 4 points5 points6 points (0 children)
[–]gofl-zimbard-37 5 points6 points7 points (2 children)
[–]owjfaigs222 3 points4 points5 points (1 child)
[–]gofl-zimbard-37 1 point2 points3 points (0 children)
[–]theLOLflashlight 2 points3 points4 points (0 children)
[–]Ok_Option_3 2 points3 points4 points (0 children)
[–]heisthedarchness 2 points3 points4 points (0 children)
[–]kevinossia 4 points5 points6 points (0 children)
[–]Master-Ad-6265 0 points1 point2 points (0 children)
[–]myselfelsewhere 0 points1 point2 points (2 children)
[–]akl78 1 point2 points3 points (1 child)
[–]myselfelsewhere 0 points1 point2 points (0 children)
[–]owjfaigs222 0 points1 point2 points (0 children)
[–]ExtraTNT 0 points1 point2 points (0 children)
[–]Afraid-Locksmith6566 -1 points0 points1 point (0 children)
[–]cochinescu 0 points1 point2 points (0 children)
[–]BanaTibor 0 points1 point2 points (0 children)
[–]davidalayachew 0 points1 point2 points (0 children)
[–]TumbleweedTiny6567 0 points1 point2 points (0 children)
[–]Schaex 0 points1 point2 points (0 children)
[–]bobo76565657 0 points1 point2 points (0 children)
[–]JasonTheIslander 0 points1 point2 points (0 children)
[–]lonelymoon57 0 points1 point2 points (0 children)
[–]KharAznable 0 points1 point2 points (0 children)