15 ms·
Very cool to see that Scala continues to have a huge impact on Java’s roadmap. Records and Sealed Classes are borrowed from Scala. Could be not the best news
by dadoge 6y ago
Very cool to see that Scala continues to have a huge impact on Java’s roadmap.
Records and Sealed Classes are borrowed from Scala.
Could be not the best news for new Scala adoption, but good news for developers having better abstractions in Java
Edit: Kotlin, and other languages should also mentioned since they also include similar features. I still think Scala has had the most influence over the years.
- meddlepal 6y agoI think the reaction has been more to Kotlin than Scala.
- jmarcher 6y agoArguably, Kotlin took some of the better ideas from Scala.
- virtualwhys 6y agoArguably? I'd say it's rather obvious, but overall they're different languages with different goals.
- Koshkin 6y agoTo be fair, “arguably” has come to mean “no doubt.”
- jmarcher 6y agoYou are thinking about "unarguably". ;)
- Koshkin 6y agoNo, 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 https://www.thefreedictionary.com/arguably
- dadoge 6y agoI’m more a Scala dev than Kotlin Think it’s safe to say both influenced Java’s Record, shoulda mentioned Kotlin too.
- Number157 6y agoKotlins 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.
- ragnese 6y ago"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.
- kaba0 6y agoBecause 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.
- ragnese 6y ago> 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.
- wpietri 6y agoI hope they're subsidizing the Scala project, and Kotlin too. Nothing better for a dominant player than having other people scout the territory for you.
- geodel 6y agoI think millions of man hours went in JVM development will count for lot of subsidy.
- JohnKacz 6y agoI saw someone recently post the idea that Java/Scala/F# almost functioned as LTS/Stable/Dev in reference to how these languages were sharing impact.
- ragnese 6y agoI think the person actually said Java/C#/F#. But in any case, I'm thinking that the real timeline is more that Java is prioritizing features that are most attractive from Kotlin, which borrowed the ideas from Scala. But Scala never got super popular, so there was not much pressure or "proof" that these were good ideas until everyone fell in love with Kotlin.
- mdm12 6y agoWe see similar developments with C# borrowing features from F#, with records in v9, pattern matching, etc. While it's good for C#/Java, it does make it harder to push for adoption for a language such as Scala and F#. Why bother investing in the languages with a much smaller market share when the big boys adopt good bits and pieces from them constantly?
- gugagore 6y ago> Why bother investing in the languages with a much smaller market share when the big boys adopt good bits and pieces from them constantly? This won't always apply, but sometimes (many times?) there's a software endeavor that permanently feels on the margins of a programming language's capabilities, whatever that means. You may forego market share in order to be 5 or 10 years ahead of current practice. In other words, the mainstream isn't converging to a stable F# / Scala / whatever. It's lagging behind. It's not the last time that a mainstream language adopts a feature that has been available for years in a more fringe ecosystem. In practice, I'm sure the most important thing is humans and their skill, so mainstreamness matters. But if you can somehow be less sensitive to that, you may reap a lot of benefit from using Foo before it was cool.
- geodel 6y agoAnother thing to note that cutting edge languages do not always deliver great features , they also deliver with great frequency half baked features to be discarded or deprecated in few years. Also since most effort spent on language , tooling remain primitive and slow for long time. So I do not see them a sure win for projects I work on.
- gugagore 6y agoGreat point about half-baked features. The investment boils down to risk-reward. Can we say that the features that are introduced into Java at this point are features that have stood the test of time in other languages?
- 6y ago
- BoyRobot777 6y agoWhy not Kotlin, C#, F#, ML and so many other languages?
- Decabytes 6y agoThis is why it's so important to have different programming languages! Sometimes it's hard to do things differently when you are just looking at your own programming language, and the tools it has available to it. Not everyone programming language needs to be a behemoth to be useful to other people. I say keep making new an interesting programming languages! It will only lead to better programming languages over all
- bishop_mandible 6y ago> Records (...) are borrowed from Scala. I think records already existed in FORTRAN and other languages like ALGOL-60. C has structs, too.
- deleted 6y ago[deleted]
- todd8 6y agoYes you are right, records have been around for a long time. COBOL was a popular, very early language supporting hierarchical data of different types. This dates back to approximately 1960. FORTRAN didn’t have records other than I/O “records” (at least for the first 20 years). ALGOL-60 didn’t have records. Algol-68 did have records, however Algol-68 wasn’t in very widespread use. I never had an opportunity to use it; compiler technology at that time wasn’t really ready for such a challenging language. Algol-68 may not have had widespread use, but a number of it’s features made their way into influential languages like C, Pascal, and Simula. These languages did have records. As I recall, IBM’s PL/1 did have records, I seem to recall using them in the 70’s in a PL/1 program. PL/1 was kind of an amalgamation of FORTRAN and COBOL’s features.
- cmrdporcupine 6y agoIn the end... Pascal was/is hugely influential, and, yeah, it called these kinds of things "Records." But the funny thing is it's been so long since I wrote Pascal or Modula-2 that when I first heard the term "Record" in the context of Java I never made the connection.
- ragnese 6y agoI think it's fair, though, to say that it's likely that the implementation and/or semantics may be more based on other JVM languages, who have to work on Java's terms. In particular, I'm talking about the fact that Java doesn't really have "copy types" or "pass by copy" or whatever. So, sure, C has struct, Swift has struct, etc, but Java can't really model its version off of the way those work.
- eweise 6y agoI think Kotlin is more at risk than Scala on the server at least. Scala still has a lot of advanced features that sets itself apart. Kotlin is a better Java but Java is catching up fast.
- ragnese 6y agoAgreed. But Kotlin 1.5 will have enough interesting stuff with the new inline class and const methods that I think it'll keep its appeal for quite some time.
- kaba0 6y agoBut I fear kotlin will fall in-between all the platforms they try to support, and will end up comparatively bad on all. Like, you can’t really target both your coroutines on each platform as well as project loom properly, same with project Valhalla and the like.
- ragnese 6y agoWhy can't coroutines take full advantage of Loom's green threads on JVM and do other stuff on Native/JS/whatever? I generally agree that being multiplatform is a lofty goal. And as much as I like Kotlin, it clearly inherits some of Java's (IMO) deficiencies. I'm not sure why I'd want those deficiencies exported to my native code when I could use lots of other nice languages.
- BoyRobot777 6y agoI think Loom can be abstracted away by Kotlin quite easily. Valhalla on the other hand won't work at all. You won't be able to have inline classes in android/older Java versions. Even more - specialized generics.
- jicea 6y agoDeveloping now 80% in Kotlin and 20% in Java (on backend), I really think the main advantage of Kotlin over Java is nullability. You can use @Nullable/@NotNull annotations in Java, but nullability being a part of the type system in Kotlin is better. I also love being able to create simple functions and add extension methods to existing classes. But still, nullability is the strongest advantage of Kotlin and I don’t see how Java will address it.
- u678u 6y agoI spent a few years moving to Scala but have come back as Java really does everything I want now. Just Akka is a bit clunky.
- sireat 6y agoBesides Scala, I feel both Kotlin and Rust have been heavily influenced by Scala.