{"action":"created","issue":{"url":"https://api.github.com/repos/koher/PromiseK/issues/1","labels_url":"https://api.github.com/repos/koher/PromiseK/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/koher/PromiseK/issues/1/comments","events_url":"https://api.github.com/repos/koher/PromiseK/issues/1/events","html_url":"https://github.com/koher/PromiseK/pull/1","id":113492068,"number":1,"title":"Operation queue parameter","user":{"login":"tarunon","id":1830205,"avatar_url":"https://avatars.githubusercontent.com/u/1830205?v=3","gravatar_id":"","url":"https://api.github.com/users/tarunon","html_url":"https://github.com/tarunon","followers_url":"https://api.github.com/users/tarunon/followers","following_url":"https://api.github.com/users/tarunon/following{/other_user}","gists_url":"https://api.github.com/users/tarunon/gists{/gist_id}","starred_url":"https://api.github.com/users/tarunon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarunon/subscriptions","organizations_url":"https://api.github.com/users/tarunon/orgs","repos_url":"https://api.github.com/users/tarunon/repos","events_url":"https://api.github.com/users/tarunon/events{/privacy}","received_events_url":"https://api.github.com/users/tarunon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-27T02:28:48Z","updated_at":"2015-10-27T11:01:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/koher/PromiseK/pulls/1","html_url":"https://github.com/koher/PromiseK/pull/1","diff_url":"https://github.com/koher/PromiseK/pull/1.diff","patch_url":"https://github.com/koher/PromiseK/pull/1.patch"},"body":"I hope to select operation queue in executor block like next, \r\n```swift\r\nPromise<Int>(queue) { resolve in\r\n  // this block run on \"queue\".\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/koher/PromiseK/issues/comments/151456462","html_url":"https://github.com/koher/PromiseK/pull/1#issuecomment-151456462","issue_url":"https://api.github.com/repos/koher/PromiseK/issues/1","id":151456462,"user":{"login":"koher","id":217100,"avatar_url":"https://avatars.githubusercontent.com/u/217100?v=3","gravatar_id":"","url":"https://api.github.com/users/koher","html_url":"https://github.com/koher","followers_url":"https://api.github.com/users/koher/followers","following_url":"https://api.github.com/users/koher/following{/other_user}","gists_url":"https://api.github.com/users/koher/gists{/gist_id}","starred_url":"https://api.github.com/users/koher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koher/subscriptions","organizations_url":"https://api.github.com/users/koher/orgs","repos_url":"https://api.github.com/users/koher/repos","events_url":"https://api.github.com/users/koher/events{/privacy}","received_events_url":"https://api.github.com/users/koher/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T11:01:18Z","updated_at":"2015-10-27T11:01:18Z","body":"Thanks for your PR 👍\r\n\r\nHowever I think keeping `init(_ executor: (resolve: Promise<T> -> ()) -> ())` is better for the following 2 reasons.\r\n\r\n#### 1. The initializer with a queue is confusing\r\n\r\n`Promise<Int>(queue) { resolve in` is a little confusing because it looks also like specifying the `queue` in which the `resolve`'s handlers is executed.\r\n\r\n#### 2. It's rare that we need to specify the queue\r\n\r\nI think it's rare that we need to specify the `queue` in which the `executor` is executed. The following is the `Promise` version implementation of `UIView#animateWithDuration` in [koher/UIKit-PromiseK](https://github.com/koher/UIKit-PromiseK). \r\n\r\n```swift\r\nextension UIView {\r\n    public class func promisedAnimate(duration duration: NSTimeInterval, delay: NSTimeInterval = 0.0, options: UIViewAnimationOptions = [UIViewAnimationOptions.CurveEaseInOut, UIViewAnimationOptions.TransitionNone], animations: () -> Void) -> Promise<Bool> {\r\n        return Promise<Bool> { resolve in\r\n            UIView.animateWithDuration(duration, delay: delay, options: options, animations: animations) { finished in\r\n                resolve(Promise(finished))\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n`UIView#animateWithDuration` must be called on the main thread. Because the `executor` is always executed synchronously on the same thread on which the initializer is called, it doesn't guarantee that `UIView#animateWithDuration` in the `executor` is called on the main thread. However it's no problem if I give a rule such that `promisedAnimate` must be called on the main thread as well as `UIView#animateWithDuration`. I think it is a natural restriction. If we give such restrictions same as the original's when we implement a `Promise` version of some asynchronous function, we don't need the `queue` on which the `executor` is executed.\r\n\r\nIn the rare cases, we can do it simply in the following way.\r\n\r\n```swift\r\nPromise<Int> { resolve in\r\n\tdispatch_async(queue) {\r\n\t    ...\r\n    }\r\n}\r\n```\r\n\r\nI think it's better to keep the APIs simple than assing the argument for the rare cases.\r\n\r\nAnyway, thanks a lot for your proposal. It made clarify my thoughts 😉\r\n"}}