nickfargo/restate — pull request #1 by nickfargo (2013-05-29 22:07:28+00:00)
Title: Subjective context binding with optional state-binding

Makes normal subjective (`owner`) context binding the default behavior for methods defined within a `State`.

Deprecates the knotty `state.method` in favor of `state.bind` and `state.fix`.

#### state.bind

F : ( any… ) → any
( F ) → StateBoundFunction[ F ]

Boxes a provided function to mark its intent to be invoked in the context either of the `State` for which it is defined, or of its corresponding *epistate* if called on behalf of a prototypal inheritor of that `State`’s `owner`.

#### state.fix

F : ( any… ) → any
( ( autostate, protostate ) → F ) → StateFixedFunction[ F ]

Boxes a provided *combinator* to mark its intent to be invoked upon creation of the `State` for which it is defined; this `State` will be “fixed” to `autostate`, and likewise with its `protostate`, both of which will be free variables for the returned function (`F`).