More efficient memory use in future implementation

Repeated future::map function calls create a long chain of promise/future pairs. When the future is fulfilled, execution of the mapping functions might consume up the stack as they are recursively called. To avoid stack overflow, this pull request implements manual tail call optimization in the promise/future module.