Monthly Archives: April 2012

Flattening the Loan Pattern

The loan pattern is a common pattern for working with resources that should be closed or otherwise managed after use. It removes responsibility from the developer to manage a resource properly. When loaning several objects, one often ends up with nested functions. Here is a way to flatten that to make things clearer.

Posted in Scala, Small Examples | Comments Off