Package foolscap :: Module promise
[hide private]
[frames] | no frames]

Module promise

source code

Classes [hide private]
  UsageError
Raised when you do something inappropriate to a Promise.
  Promise
I am a promise of a future result.
  _MethodGetterWrapper
Functions [hide private]
 
_ignore(results) source code
 
resolvedPromise(resolution) source code
 
makePromise() source code
 
send(o)
Make an eventual-send call on object o.
source code
 
sendOnly(o)
Make an eventual-send call on object o, and ignore the results.
source code
 
when(p)
Turn a Promise into a Deferred that will fire with the enclosed object when it is ready.
source code
Variables [hide private]
  BROKEN = 3
  CHAINED = 1
  EVENTUAL = 0
  NEAR = 2
Function Details [hide private]

send(o)

source code 

Make an eventual-send call on object o. Use this as follows:

p = send(o).foo(args)

o can either be a Promise or an immediate value. The arguments can either be promises or immediate values.

send() always returns a Promise, and the o.foo(args) method invocation always takes place in a later reactor turn.

Many thanks to Mark Miller for suggesting this syntax to me.

when(p)

source code 

Turn a Promise into a Deferred that will fire with the enclosed object when it is ready. Use this when you actually need to schedule something to happen in a synchronous fashion. Most of the time, you can just invoke methods on the Promise as if it were immediately available.