News for hackers. Stuff that matters.
Re:Java 16 by meddlepal on Tuesday March 16, 2021 @11:08AM (#26477715)
I think the reaction has been more to Kotlin than Scala.
Re:Java 16 by jmarcher on Tuesday March 16, 2021 @11:31AM (#26478126)
Arguably, Kotlin took some of the better ideas from Scala.
Re:Java 16 by virtualwhys on Tuesday March 16, 2021 @11:54AM (#26478467)
Arguably? I'd say it's rather obvious, but overall they're different languages with different goals.
Re:Java 16 by Koshkin on Tuesday March 16, 2021 @03:09PM (#26481421)
To be fair, “arguably” has come to mean “no doubt.”
Re:Java 16 by jmarcher on Wednesday March 17, 2021 @12:26PM (#26493364)
You are thinking about "unarguably". ;)
Re:Java 16 by Koshkin on Wednesday March 17, 2021 @03:28PM (#26495778)
No, I was talking about the now usual in the English-speaking practice amplification of its meaning as "can be supported or shown by persuasive argument", e.g., That is arguably the best book on the subject.

https://www.thefreedictionary.com/arguably

Re:Java 16 by dadoge on Tuesday March 16, 2021 @11:37AM (#26478224)
I’m more a Scala dev than Kotlin

Think it’s safe to say both influenced Java’s Record, shoulda mentioned Kotlin too.

Re:Java 16 by Number157 on Tuesday March 16, 2021 @11:53AM (#26478446)
Kotlins data class is functionally basically the same as a lombok @Data class used in Java. Why Java didn't keep the name "Data class" I don't know.
Re:Java 16 by ragnese on Tuesday March 16, 2021 @02:54PM (#26481223)
"Data" is such an overloaded and vague term, anyway. Almost all classes have "data", so what the heck is a "data class"? Is it one that only has data (not behavior)? Nope- these can have arbitrary methods.

So, I'm kind of glad they didn't use it. (But, to clarify, I really don't care what color the bike shed is)

I'm more wondering why they didn't go with "struct" or "value class", especially because the latter is exactly what we've been calling "class whose equals() is defined by content rather than identity" for many years.

Re:Java 16 by kaba0 on Tuesday March 16, 2021 @04:24PM (#26482362)
Because while in the end project valhalla will not call them value classes, it is a sort of an overloaded term.

Structs/value types can be mutable, records are not. They are basically tuples with names. And as far as I know, while records have a sane default equals defined, they are still identity objects in that they are passed by reference.

Re:Java 16 by ragnese on Tuesday March 16, 2021 @04:48PM (#26482751)
> Structs/value types can be mutable, records are not.

Fair point about record fields not being reassignable (not the same as immutable for others reading this).

> And as far as I know, while records have a sane default equals defined, they are still identity objects in that they are passed by reference.

Well, sure. All non-primitives are passed by reference. That doesn't stop them from being referred to as value types.

But in light of your first point, I agree that choosing a totally new term probably makes sense.

Re:Java 16 by kaba0 on Tuesday March 16, 2021 @07:07PM (#26484395)
I stand corrected, shallowly immutable or as you note fields not being reassignable it is.