Giter VIP home page Giter VIP logo

Comments (3)

wvteijlingen avatar wvteijlingen commented on May 18, 2024

I had the same problem and solved it by removing the inner set of parentheses in the success call.

from brightfutures.

erickreutz avatar erickreutz commented on May 18, 2024

My example in was a simplified version of what I'm actually doing. That simplified version works by removing the inner set of parentheses but when I do the same when using generics instead of Int, String I still can't get it to work.

Here is an example using generics that doesn't work.

func someFunc<U,V>(someU: U, someV: V) -> Future<(U,V)> {
  var promise = Promise<(U,V)>()

  promise.success( (someU, someV) )

  return promise.future
}

from brightfutures.

Thomvis avatar Thomvis commented on May 18, 2024

I can imagine that this is something that the compiler has trouble with (although it shouldn't). However, I can't seem to reproduce the issue as it seems to work fine for me. I've pasted the following code in BrightFuturesTests.swift and it behaves as expected:

func testSucceedingFutureWithTuple() {

    func someFunc<U,V>(someU: U, someV: V) -> Future<(U,V)> {
        var promise = Promise<(U,V)>()

        promise.success( (someU, someV) )

        return promise.future
    }

    let f = someFunc("BF", 2014)

    let e = self.expectationWithDescription("")

    f.onSuccess { val in
        e.fulfill()
    }

    self.waitForExpectationsWithTimeout(2, handler: nil)
}

Am I missing something? I am using Xcode 6.0.1 (6A317). If this doesn't work for you, could you try to make the parameter of promise.success an @autoclosure to see if that solves the issue? Thanks!

from brightfutures.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.