Sunday, October 14, 2007

Fun With Scala: Liftweb

In my last post, I poked some serious fun at a bunch of mainstream languages (actually, their Internet communities), but left Scala pretty much alone. I chose Ruby and Java as my main characters because those are the languages I read the most about, and whose pundits' positions I felt like I could parody most accurately.

I've been interested in Scala since I first came across it, but I haven't really had to time to do much with it. I like its functional leanings, and I am intrigued by its ability to run on the JVM and interoperate seamlessly with existing Java libraries. Although when I say "interoperate", I have to acknowledge that it's a one-way street, as far as I know. Scala code can certainly invoke methods on Java classes. I have yet to figure out how to make the reverse happen (not that I've tried very hard). If I can, I will definitely try to make use of that capability.

So I've decided to do something real with Scala, to force myself to get to know it better. I've chosen Liftweb as my target project, largely because it's there and it's the only substantive chunk of Scala code I've found. You may have read about its claims to be able to implement a full-on Twitter clone in less than 1000 lines of code, with the capability of handling one million or more users on a single commodity PC.

Attention has been paid.

3 comments:

AlBlue said...

It can be a two-way street; since Scala classes can subclass (or implement) Java interfaces, you can have the interface in Java but implement it in Scala.

You can even write OSGi bundles in Scala:

http://neilbartlett.name/blog/2007/04/06/an-osgi-bundle-built-in-scala/

Unknown said...

It's not quite "seemless" -- some weak areas in the linkage are Java generics (I've heard rumors these are supported in the latest snapshots) and Java annotations.

David Rupp said...

Well. Java generics use type erasure, which I can see maybe causing some problems. But I'm generally not a fan, so incompatibility with Java generics is not a downcheck in my book.