Scala: Bottom-Up Programming

Programming “bottom-up” is a term best defined by describing programming in Lisp: extending the language to solve your problem, instead of just using existing language constructs.

Just got through reading this (new library from foursquare for a type-safe MongoDB query DSL), and it made me think that if more and more people start adopting Scala, we might enter a new Programming Golden Age. If you don’t believe me after reading that, consider:

  • The expressiveness of their improved query language. Beautiful, isn’t it?
  • The code for the DSL itself. It’s simple and only about a few hundred lines.
  • The ease with which they integrated it into the library they already use.

That last point was the one that struck me the most. Implicits and DSLs feel like a way to code “bottom-up” without sacrificing safety. Imagine being to easily and quickly bolt new features onto a language, but with type-safety and without changing the behavior of any of the code being extended.

Wouldn’t that be a nice?