Creates a new future.
Creates a new promise.
Examples:
Evaluate an operation in another thread
x = future { 3 + 3 }
Yields:
A block to be optimistically evaluated in another thread.
Yield Returns:
The return value of the block will be the evaluated value of the future.
Returns:
62 63 64
# File 'lib/future.rb', line 62 def future(&block) Future.new(&block) end
Lazily evaluate an arithmetic operation
x = promise { 3 + 3 }
A block to be lazily evaluated.
The return value of the block will be the lazily evaluated value of the promise.
87 88 89
# File 'lib/promise.rb', line 87 def promise(&block) Promise.new(&block) end