Scala/Java interop
From Lift
These following are notes on the "Scala and Java Interoperability" session of the Scala lift off conference. They were taken by Niels Vaneck and originally posted here.
- Currently, some people are using scala in existing java projects. general take-aways:
- difficult build process to get around dependency problems (2 compile steps required)
- different ways of calling into the scala code
- reflection against a certain java interface
- directly calling the classes generated by scalac
- + - operators as methods can be called by adding $
- traits turn into interfaces, it is possible to call them & implement them in certain cases (when there are methods)
- incompatibility problems with 3rd party libraries, which generally restricts scala touch points to those in 'your control'
Future scala compiler will compile java and scala files in one pass, which solves cyclic dependency problem
calling into scala from java currently opens up the 'complicated' side of scala to the caller. suggestion, create a facade to the class you write that you can easily call into from java.
- Generics (scala) will be exposed to java
- solve naming issues
- compile java and scala in one shot
Scala & Java in the workplace
- Scala's ability to specify domain specific languages (by creating 'verbose' libraries) could help programmers focus on their functionality
- at the same time, there are worries that exposure to scala's 'details' may scare your average colleague.
- Scala seen as complicated language that in general, you need savvy developers for.
- Again, (as in the learning scala session) dynamic typing comes up as a possible problem
- and again.. tooling would help alleviate the problem.

