 // Promise
 public class Promise<T> {
     
-    public let future = Future<T>()
+    public let future : Future<T>
     
     public var completed : Bool {
         return self.future.completed
     }
     
     public init() {
-    }
-    
+        self.future = Future<T>()
+    }
+
+    public init(queue:Queue) {
+        self.future = Future<T>(queue:queue)
+    }
+
     public func completeWith(future:Future<T>) {
         self.completeWith(self.future.defaultExecutionContext, future:future)
     }

        return result;
    }
    
    public func async(block:dispatch_block_t) {
        dispatch_async(self.queue, block);
    }
    
}


    public func success(value:T) {
        self.future.success(value)
    }

    public func failure(error:NSError)  {
        self.future.failure(error)
    }

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Future
public class Future<T> {
    
    internal let defaultExecutionContext: ExecutionContext  = QueueContext.main

    private var result:Try<T>?

    typealias OnComplete                                    = Try<T> -> Void
    private var saveCompletes                               = [OnComplete]()
    private let futureQueue : Queue
    
    public var completed : Bool {
        return self.result != nil
    }
    
    public init() {
        self.futureQueue = Queue.simpleFutures
    }
    
    public init(queue:Queue) {
        self.futureQueue = queue
    }

    // should be future mixin
    internal func complete(result:Try<T>) {
        self.futureQueue.async {
            if self.result != nil {
                SimpleFuturesException.futureCompleted.raise()
            }
