March 2010
6 posts
1 tag
an old man and a park bench
I sat down next to an old man on a park bench today. He said to me: Are you just going to sit there? So I said: Why do you ask? To which he replied: I’m an old man. These days, what I enjoy most is to sit here and watch others go about their business, over and over, and over again. I went on my way. I came back to the bench the next day and the old man and the bench was...
Mar 23rd
1 note
scope escaping shadow of peter pan
I just thought the error message the following code generates was a little silly. object PeterPan { private case class Shadow(length: Int) def shadow = Shadow(10) } error: private class Shadow escapes its defining scope as part of type PeterPan.Shadow
Mar 22nd
3 notes
an applied case for red ninjas
One of my favorite things about scala are case classes. Those coming from a java background might be used to writing code like this. public class Ninja { private int experience; private List<Weapon> weapons; private String color; public Ninja(int experience, List<Weapon> weapons, String color) { this.experience = experience; this.weapons = weapons; this.color =...
Mar 20th
implicitly subtle imports
One of Scala’s cheekier features, implicit declarations, can sometimes conjure up subtle gotchas. Besides being infamous for being a pimp, Scala’s implicits are also play the role of a magician by providing the illusion of default function arguments, a first class feature in 2.8. I recently came across a subtle gotcha when using implicit function arguments, but first, it might be...
Mar 16th
1 note
1 tag
37 salad dressings
I’m thinking of a spork with no knives As a younger man, one of my favorite types of restaurants to eat at were buffets.  What can be better than an endless supply of everything? I pay one price and get as much as I want. So many choices! As I got a little older, I started noticing a couple things about these types of restaurants.  For starters, I never actually ate everything on the...
Mar 13th
2 tags
i've got objects in my specs
If you are a bdd’r and just happen to be upgrading from sbt 0.5.6 to 0.7.1, when you run your specs, you just might be greeted with the lovely message: Could not instantiate class foo.Bar: foo.Bar The quick fix is to write your specs as classes rather than objects. I know. Classes? I’m using the latest 2.7.7 supported version of specs. val specs = "org.scala-tools.testing" %...
Mar 2nd
1 note