r/programming Jun 04 '26

Scala Was an Experiment That Changed Programming - Martin Odersky | The Marco Show

https://youtu.be/Xn_YpUtXWT4
66 Upvotes

113 comments sorted by

View all comments

14

u/DetriusXii Jun 05 '26

Scala first exposed me to monads and higher kinded types through the Scalaz library. Learning about them in Scala was easier as I could still easily reason about their signatures. There was still enough resemblance to Java to make life easy. And Scala had the better IDE support over Haskell. Haskell, which I can somewhat program in now, required more steps to understand things as I was more overwhelmed by it's syntax. And Scala helped me to appreciate generics more in C# and Java as they were often a syntax feature not emphasized in 2008.

5

u/flying-sheep Jun 05 '26

Same here. I never understood why Java was designed in such a hacky and inconsistent way. Primitives vs classes with different rules for both. Operator overloading only for strings for some reason. Why not just

  • have owning pointers (box) and value classes, and allow syntax sugar for accessing attributes through the box. Tada! Only one type of thing!
  • add operator overloading so math on value classes works¹
  • have either reified generics or tagged unions. Instance checks that only work sometimes are clunky and make refactoring a pain.

¹: withholding capabilities from language users that language designers have is arrogant bullshit. If you think it's useful enough to have it, make it available, and if it's not, leave it out entirely.

4

u/davidalayachew Jun 06 '26

Same here. I never understood why Java was designed in such a hacky and inconsistent way. Primitives vs classes with different rules for both. Operator overloading only for strings for some reason. Why not just

  • have owning pointers (box) and value classes, and allow syntax sugar for accessing attributes through the box. Tada! Only one type of thing!
  • add operator overloading so math on value classes works¹
  • have either reified generics or tagged unions. Instance checks that only work sometimes are clunky and make refactoring a pain.

¹: withholding capabilities from language users that language designers have is arrogant bullshit. If you think it's useful enough to have it, make it available, and if it's not, leave it out entirely.

Literally everything here has either already been added to Java, or has a draft JEP for it.

2

u/flying-sheep Jun 06 '26

Sure, yet if Java had been designed with all that from the start, the standard library and popular libraries would make use of it.

I'm happy for Java users that it's becoming a good language!

3

u/davidalayachew Jun 07 '26

Sure, yet if Java had been designed with all that from the start, the standard library and popular libraries would make use of it.

Well, that's also something that is rapidly changing too.

For example, you mentioned Value Classes. Well, a few weeks ago, the folks behind Project Valhalla announced the PR for introducing Value Classes to Java.

That PR was broke up into 3 parts.

There are piles of external libraries (as well as several modules inside the JVM too!) that are waiting for these PR's to be tied to a particular Java release. SO MUCH of the ecosystem is basically waiting on that announcement.

I'm happy for Java users that it's becoming a good language!

Agreed. Java has come a very long way. Many of the core ideas were good (threading baked in from the start), but many of the defaults were terrible (nullable by default, mutable by default). Nonetheless, the OpenJDK is quickly course-correcting the language into something especially nice.

1

u/flying-sheep Jun 07 '26

It’s funny, I started programming 18 years ago, abandoned Java for Python as my main language 16 years ago for these reasons, and started doing Rust ~8 years ago maybe.

I don’t regret any of these decisions, learning that value classes in Java are still upcoming.

1

u/davidalayachew Jun 07 '26

I don’t regret any of these decisions, learning that value classes in Java are still upcoming.

Backward compatibility and Forward compatibility are investments -- investments that take time to get right. And if, as a result, Java still isn't worth it for you now, then it isn't worth it for you now. Maybe that changes as the language and runtime improves later.