The point is missed

Museum of public mistakes and unfinished projects

Posts Tagged ‘Nugget

Scala Nugget – Pattern matching and Lists

with 7 comments

I was whining recently about how my scala-code is java in poor disguise. I started reading the scala by example pdf that also comes with the scala installation. I just read some interesting things about lists and pattern-matching that gave me an idea how to “scalafy” the following scjava-code:

Read the rest of this entry »

Advertisements

Written by johlrogge

October 6, 2008 at 10:27 pm

Posted in scala

Tagged with , , , , ,

Scala Nugget – implicits to make java blend into Scala

with 2 comments

Most of my posts related to Scala so far have been quite long and unpolished I have intentionally kept them that way since I wanted to give a feel for what i is really like to make the shift, including the dead ends.

During the work of converting Java to Scala I have stumbled over some things that I found to be extra cool, nuggets. I’ll try to post them here from time to time.

The first nugget is about implicits. Implicits are so cool that I think I will shoot myself in the foot with them many times so let’s start now. One piece of java-code that I converted looked for module descriptions on the class-path. The code looked something like this:

Read the rest of this entry »

Written by johlrogge

September 11, 2008 at 9:06 pm

Posted in java, scala

Tagged with , ,