java.math.BigInteger 라이브러리를 쓴다고 가정하자.

분배법칙 Test한다 치면


Kotlin이나 Scala에서


val a = BigInteger("1894172491274189274912471247")

val b = BigInteger("48293812938172379")

val c = BigInteger("2839127412847192471248")


if (a*(b + c) == a*b + a*c && (a+b)*c == a*c + b*c) {

    ....

}


이게 Java에서


BigInteger a = BigInteger("1894172491274189274912471247")

BigInteger b = BigInteger("48293812938172379")

BigInteger c = BigInteger("2839127412847192471248")


if (a.multiply(b.add(c)).equals(a.multiply(b).add(a.multiply(c))) && a.add(b).multiply(c).equals(a.multiply(c).add(b.multiply(c)))) {

    ....

}


이렇게 됨


행렬이나 복소수 쓰면 맨날 이따구로 써야 됨

자바가 저렇게 연산자 오버로딩 막은 이유 보면 더 좆같음


Because James Gosling (자바 창시자) said so:

I left out operator overloading as a fairly personal choice because I had seen too many people abuse it in C++.

James Gosling. Source: http://www.gotw.ca/publications/c_family_interview.htm


Please compare Gosling's text above with Stroustrup(C++ 창시자)'s below:

Many C++ design decisions have their roots in my dislike for forcing people to do things in some particular way [...] Often, I was tempted to outlaw a feature I personally disliked, I refrained from doing so because I did not think I had the right to force my views on others.

Bjarne Stroustrup. Source: The Desing and Evolution of C++ (1.3 General Background)


니좆 애미