Long Live Static Typing!

I just read an article that mentioned dynamic and statically typed languages, and I also just looked up Ruby's yield statement. One of the examples on the page I found was this:

class SongList
  def [](key)
    if key.kind_of?(Integer)
      @songs[key]
    else
      # ...
    end
  end
end

The problem I have is with the if key.kind_of?(Integer). I've been toying with Lisp some, and it reintroduces static typing (think C/C++ function/method arguments). So the above could be simplified a lot, especially if a method needed to be specialized for a ton of types. This could be done by specifying an argument's type. The following would work perfect, and could allow some optimizations to be made too:

class SongList
  def [](Integer key)
    @songs[key]
  end

  def [](key)
    # ...
  end
end

Ad's by Google