|
|
|
|
|
by joegaudet
4263 days ago
|
|
Fair Warning, I worked with the other for some time, and have been having an out of band convo with him. One of the things I absolutely HATE about scala is operator overloading - and the excessive abuse of it. I ran into it just now using some library that used ==. A Case: List(1,2) == List(1,2); true
Array(1,2) == Array(1,2); false The reason for this is obvious, list implements equals and does a deep compare. While Array.equals is a pointer compare (like how java do). This would be obvious in Java because that would look like. ArrayList<> a = ArrayList<Int>();
ArrayList<> b = ArrayList<Int>();
a.equals(b); // equal because it's a value compare versus int[] a = new int[5]
int[] b = new int[5]
a == b; // obviously false because it's a reference compare. The lack of a universal idea about what == means is pretty dangerous IMO. *edited for spelling |
|
There is an universal idea what == means, it's quite simple and more consistent then the mess Java has.
It's just that the JVM's idea cannot be brought in line with it consistently.
If you look at the history of Scala, you'd see that they tried to make Arrays work this way for 5+ years.
The blood being shed just wasn't worth the quirks it caused in other parts and in the end trying to fix the JVM's idea of arrays was abandoned.