Thomvis/BrightFutures

Promise with success type of Self

Closed this issue · 1 comments

Quite new to Swift so this may well be an issue with my knowledge rather than Bright Futures itself but should it be possible to create a Promise that has a success type of Self in a protocol extension?

extension Promiser {
    func promise() -> Future<Self, Error> {
    let promise = Promise<Self, Error>()

    return promise.future
  }
}

Gives me the exceptionally helpful xcode error Consecutive statements on a line must be separated by ';'

As you suggest, this is something that is not possible in Swift and is not a problem related to BrightFutures. I'd look into adding an associatedtype to Promiser and use that instead of Self.