Dynamic Types in Scala 2.10
This blog explores Scala dynamic types, a new feature of Scala 2.10, and provides some hopefully interesting exercises so you can try it out for yourself. ?
Why Dynamic Types in a Static Languages?
If you use Java or Scala instead of, say, Python or Clojure, it's probably because you like compile-time type checking. Personally, if I make a sloppy error, I prefer to have the bad news up front than discover it later through tedious debugging. Still, it's hard not to be envious when I see features such as Ruby's ActiveRecord ORM that peeks at the database and automatically makes classes out of tables, turning column names into field names. Without any boilerplate, the Ruby programmer can write
empl.lname = "Doe".
I realize it's not like solving world hunger. In Java and Scala, I can perfectly well write
empl.set("lname", "Doe"). But still, I am envious.
Scala, never a language to leave an enviable feature on the table, gives you that syntactic sugar