Babysteps in Scala
There are always some Java developers who attend whenever I give my .NET DSL talk. This is super cool, and at it makes for some new challenges. The most common one is “How can we do these things with Java”. Since the JavaZone guys have introduced an emerging languages track and extended their call for papers deadline to next month, I figured “porting” the talk to the Java platform would be cool. The downside* is that, until somebody writes “Boo4J”, I have to learn some more “Java” languages to explore the possibilities. I’ve spent a couple of evenings with Scala, and I’m really pleased with what I’ve got so far…

Being used to mainly using imperative languages, I had to learn a couple of new tricks to get this thing running. The first was how one can pass a first-class function as a by-name parameter. This is used for the predicates. The other was how to use currying to make the when function look like a keyword. The cool thing was that this was super duper simple. All in all, less than 20 (!) lines of code was required. Looks like I’m catching the Scala bug too…
*Well, learning new languages isn’t really a downside…
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using