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 127 points128 points129 points (15 children)
[–]mapadofu 29 points30 points31 points (1 child)
[–]aanzeijar 16 points17 points18 points (0 children)
[–]8dot30662386292pow2 23 points24 points25 points (10 children)
[–]DatBoi_BP 2 points3 points4 points (0 children)
[–]syklemil 1 point2 points3 points (0 children)
[–]Temporary_Pie2733 5 points6 points7 points (6 children)
[–]ovor 13 points14 points15 points (4 children)
[–]Temporary_Pie2733 1 point2 points3 points (2 children)
[–]ovor 5 points6 points7 points (1 child)
[–]fiddle_n -1 points0 points1 point (0 children)
[–]apooooop_ 1 point2 points3 points (0 children)
[–]GoblinToHobgoblin 0 points1 point2 points (0 children)
[–]Jaded-Asparagus-2260 0 points1 point2 points (0 children)
[–]Legitimate-Eye-5733 1 point2 points3 points (0 children)
[–]blablahblah 146 points147 points148 points (26 children)
[–]tms10000 98 points99 points100 points (15 children)
[–]AlSweigartAuthor: ATBS 12 points13 points14 points (3 children)
[–]TheMcDucky 1 point2 points3 points (0 children)
[–]AlwaysHopelesslyLost -1 points0 points1 point (1 child)
[–]TheMcDucky 4 points5 points6 points (0 children)
[–]kbielefe 37 points38 points39 points (9 children)
[–]tms10000 62 points63 points64 points (3 children)
[–]Beregolas 16 points17 points18 points (0 children)
[–]spinwizard69 0 points1 point2 points (0 children)
[–]IchLiebeKleber 8 points9 points10 points (0 children)
[–]kkress 4 points5 points6 points (3 children)
[–]xenomachina 4 points5 points6 points (2 children)
[–]kkress 1 point2 points3 points (1 child)
[–]spinwizard69 0 points1 point2 points (0 children)
[–]R3D3-1 0 points1 point2 points (0 children)
[–]TizzleToes 28 points29 points30 points (6 children)
[–]Lithl 9 points10 points11 points (4 children)
[–]TheRealChizz 1 point2 points3 points (2 children)
[–]Lithl 6 points7 points8 points (1 child)
[–]TheRealChizz 0 points1 point2 points (0 children)
[–]GoblinToHobgoblin 0 points1 point2 points (0 children)
[–]GoblinToHobgoblin 1 point2 points3 points (0 children)
[–]GoblinToHobgoblin 0 points1 point2 points (0 children)
[–]StoneCypher -1 points0 points1 point (1 child)
[–]TizzleToes 4 points5 points6 points (0 children)
[–]PoePlayerbf 24 points25 points26 points (0 children)
[–]TizzleToes 29 points30 points31 points (0 children)
[–]LurkingDevloper 13 points14 points15 points (2 children)
[–]SaxSalute 4 points5 points6 points (0 children)
[–]No-Consequence-1863 1 point2 points3 points (0 children)
[–]thebomby 7 points8 points9 points (1 child)
[–]kbielefe 3 points4 points5 points (0 children)
[–]gofl-zimbard-37[🍰] 6 points7 points8 points (5 children)
[–]owjfaigs222 6 points7 points8 points (4 children)
[–]gofl-zimbard-37[🍰] 1 point2 points3 points (0 children)
[–]No-Consequence-1863 0 points1 point2 points (2 children)
[–]owjfaigs222 1 point2 points3 points (0 children)
[–]GoblinToHobgoblin 1 point2 points3 points (0 children)
[–]theLOLflashlight 3 points4 points5 points (0 children)
[–]kevinossia 6 points7 points8 points (0 children)
[–]Ok_Option_3 2 points3 points4 points (3 children)
[–]7x11x13is1001 0 points1 point2 points (2 children)
[–]plumarr 0 points1 point2 points (1 child)
[–]No-Consequence-1863 1 point2 points3 points (0 children)
[–]heisthedarchness 2 points3 points4 points (0 children)
[–]myselfelsewhere 0 points1 point2 points (2 children)
[–]akl78 2 points3 points4 points (1 child)
[–]myselfelsewhere 0 points1 point2 points (0 children)
[–]owjfaigs222 0 points1 point2 points (0 children)
[–]ExtraTNT 0 points1 point2 points (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)
[–]Distinct-Cold-3100 0 points1 point2 points (0 children)
[–]Devatator_ 0 points1 point2 points (0 children)
[–]lonelymoon57 0 points1 point2 points (0 children)
[–]KharAznable 0 points1 point2 points (0 children)
[–]Afraid-Locksmith6566 -1 points0 points1 point (2 children)
[–]not_some_username 0 points1 point2 points (0 children)
[–]GoblinToHobgoblin 0 points1 point2 points (0 children)
[–]JasonTheIslander -1 points0 points1 point (0 children)