4 ms·
No, it's not. Scala can call Java easily, but not the other way around. Calling Java from Scala is awkward at best (in many cases) and sometimes impossible. Sca
by cryptos 9y ago
No, it's not. Scala can call Java easily, but not the other way around. Calling Java from Scala is awkward at best (in many cases) and sometimes impossible. Scala was never engineered with a smooth Java/Scala mixed mode in mind. The opposite is true: In Scala almost everything from Java gets reinvented sooner or later.
- eeperson 9y agoThis hasn't matched my experience. > Calling Java from Scala is awkward at best (in many cases) and sometimes impossible. Scala was never engineered with a smooth Java/Scala mixed mode in mind. I assume you meant calling Scala from Java here. With that in mind, writing an API that is easy to use from Java isn't that difficult. It is basically down to limiting the feature set you make use of in the interface and converting to Java collections. These are both pretty easy to do. Granted some Scala features are expressed in ways that are not easily used from Java. However, this just because Scala is significantly more expressive than Java. I'm not sure why you consider this to be a problem. > In Scala almost everything from Java gets reinvented sooner or later. I'm not sure what your point is with this. Scala wrappers for Java code are common but not because of issues with calling Java code. These are written because Scala can expose a much richer and much safer interface (again because Scala is much more expressive).