documentcloud/backbone — pull request #1846 by akre54 (2012-11-27 16:26:40+00:00)
Title: Allow options to be provided as a function

In the same vein as `className`, `id`, `events` et al (#1520, #1693, #1228, #1234). Allow `this.options` to be created initially as a function, giving it the ability to be inherited and extended without being overwritten.

This implementation still allows accessing options as a standard object, as `_configure` now sets `this.options` after calling it.

This will be trivial in CoffeeScript.

```
class MyView extends View
options: ->
title: 'A long time ago',
setting: 'far far away'

class ChildView extends MyView
options: ->
_.extend super, {
fixed: true,
title: 'extension'
}

initialize: ->
console.log this.options.fixed, this.options.title, this.options.setting
// true, 'extension', 'far far away'
```