In many situations I find that I need to create long-living values inside a function\'s scope, and there is no need for this data to be at class/object scope.
For ex
Extending FunctionXX is another way of achieving the goal; it might have an advantage of providing better documentation. Both parameter types and return value type are visible on the first line of the declaration:
val activeUser = new Function0[List[String]] {
val users = getUsersFromDB
def apply = users filter (_.active)
}