5 ms·
Scala does want efficient optionality in the type system - just not at the cost of a consistent representation of optionality. I'm sure an optimization for the
by lmm 11y ago
Scala does want efficient optionality in the type system - just not at the cost of a consistent representation of optionality. I'm sure an optimization for the common case would be very welcome.
I constantly see Kotlin advocates claiming better Java interop but I don't see how; Scala already has 100% Java interop as far as I can see.
- mike_hearn 11y agoLuckily JVM languages mostly interop with each other very well and the question is just convenience and efficiency. For instance, Kotlin is using the same collections library as Java. So there are no adapters or conversions needed. Scala has its own collection library instead. Scala has some constructs that can make it impossible or very difficult to call code from Java. Kotlin doesn't.
- acjohnson55 11y agoThose constructs are opt-in. People who are writing library code can choose to not use them. But in practice, people writing libraries in Scala that serve the Java community export a Java-specific API.
- lmm 11y ago> For instance, Kotlin is using the same collections library as Java. So there are no adapters or conversions needed. Scala has its own collection library instead. You can write Scala using the standard Java collections (or Guava immutable collections) if you like (especially if you're using a ScalaZ-heavy style where everything happens via typeclasses - just write typeclass instances for the collections you're using, and then it's easy to mix and match). For my money immutability is too important for it to be worth using the Java collections - even in Java I'll use the Guava ImmutableList etc. > Scala has some constructs that can make it impossible or very difficult to call code from Java. Kotlin doesn't. Such as? I mean, implicit parameters won't be implicit (but they couldn't be in Kotlin either), and higher-kinded types compile to raw methods for which you have to cast (but you'd have to do the same to express the same thing in Kotlin).
- airless_bar 11y agoFor instance, Kotlin is using the same collections library as Java. So there are no adapters or conversions needed. Scala has its own collection library instead. Years ago Scala tried the same thing Kotlin currently tries to sell as the hot new stuff. That approach was abandoned altogether, because. it. just. doesn't. work. It's a death by thousand cuts. You can keep sprinkling compiler magic on top of it, but it will be an ongoing game of whack-a-mole. See all the typesystem unsoundness and how they had to abandon (non-)null annotations for existing code because it just didn't scale/work. The whole concept of having mutable and immutable collections within the same API hierarchy that Kotlin tries to sell is also considered to be one of the remaining design issues of Scala collections. Those were terrible times. So happy that Scala doesn't do that anymore!
- ta_donk_gt 11y ago> I constantly see Kotlin advocates claiming better Java interop but I don't see how I think generally when people say this they mean things like: 1. You can freely mix and match Java and Kotlin files in the same package 2. Being a more lightweight layer on top of Java makes interop with all Java environments (specifically Android) more practical
- merb 11y agoActually Scala 2.12 will have more Java 8 Interop than Kotlin. Scala will hit soon while I don't see Kotlin Java7/Java8 soon not even a Milestone release yet.
- dastbe 11y agoThis is true, but I think it's worth looking at how far behind Scala 2.12 is from its initial release date The original roadmap: http://www.scala-lang.org/news/2.12-roadmap/ http://www.scala-lang.org/news/2.12-roadmap/ The current roadmap: http://www.scala-lang.org/news/2016-schedule/ http://www.scala-lang.org/news/2016-schedule/ For reference, M4 was released 3 days ago. JDK8 was released a little over 3 years ago, and JDK9 is about a year away which will introduce some interesting challenges. We've yet to see how fast JetBrains will iterate on Kotlin and support for JDK8, while we know exactly how fast Scala iterates.
- merb 11y agoYeah the schedule change was sad. And Scala 2.12 takes really long, but a Scala 2.11 is really solid, it just hasn't the same interop than it should have in a Java 8 world.
- airless_bar 11y agoEven Scala 2.11 has better Java 8 interop. The main change in 2.12 is that Scala itself uses Java 8 features like default methods and invokydynamic. Using Java 8 has worked with 2.11 for quite some time already.