{"action":"created","issue":{"url":"https://api.github.com/repos/zenparsing/es-observable/issues/48","labels_url":"https://api.github.com/repos/zenparsing/es-observable/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/zenparsing/es-observable/issues/48/comments","events_url":"https://api.github.com/repos/zenparsing/es-observable/issues/48/events","html_url":"https://github.com/zenparsing/es-observable/issues/48","id":97550237,"number":48,"title":"Discussion: Subscribe returns a cancellation function","user":{"login":"zenparsing","id":5995084,"avatar_url":"https://avatars.githubusercontent.com/u/5995084?v=3","gravatar_id":"","url":"https://api.github.com/users/zenparsing","html_url":"https://github.com/zenparsing","followers_url":"https://api.github.com/users/zenparsing/followers","following_url":"https://api.github.com/users/zenparsing/following{/other_user}","gists_url":"https://api.github.com/users/zenparsing/gists{/gist_id}","starred_url":"https://api.github.com/users/zenparsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenparsing/subscriptions","organizations_url":"https://api.github.com/users/zenparsing/orgs","repos_url":"https://api.github.com/users/zenparsing/repos","events_url":"https://api.github.com/users/zenparsing/events{/privacy}","received_events_url":"https://api.github.com/users/zenparsing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-07-27T20:43:08Z","updated_at":"2015-09-03T21:06:58Z","closed_at":null,"body":"In the current version, `subscribe` returns a cancellation function.  Previously, `subscribe` returned a \"subscription\" object with an \"unsubscribe\" method.\r\n\r\nRationale:\r\n\r\n1. Since working on this project, I've typed in \"subscription.unsubscribe\" many, many times.  It's ugly and a real pain.\r\n1. We currently haven't identified any essential capabilities that need to be returned from \"subscribe\" other than the cancellation function.  It's nice to avoid useless wrapper objects.\r\n1. Any additional capabilities returned from \"subscribe\" are probably going to be POLA-problematic.\r\n1. The return types of \"subscribe\" and the subscriber function align nicely.\r\n\r\nRegarding 4:\r\n\r\nWe frequently want to \"chain\" observables like this:\r\n\r\n```js\r\nfunction x(observable) {\r\n    return new Observable(observer => observable.subscribe({\r\n        // ... whatever\r\n    });\r\n}\r\n```\r\n\r\nIf \"subscribe\" returns something other than a `() => void` function, then we have to bake-in some messy overloading in order to make that chaining nice and pleasant.  RxJS makes use of overloading in several places (also \"subscribe\") which I would like to avoid.\r\n\r\nThoughts?\r\n"},"comment":{"url":"https://api.github.com/repos/zenparsing/es-observable/issues/comments/137575525","html_url":"https://github.com/zenparsing/es-observable/issues/48#issuecomment-137575525","issue_url":"https://api.github.com/repos/zenparsing/es-observable/issues/48","id":137575525,"user":{"login":"trxcllnt","id":178183,"avatar_url":"https://avatars.githubusercontent.com/u/178183?v=3","gravatar_id":"","url":"https://api.github.com/users/trxcllnt","html_url":"https://github.com/trxcllnt","followers_url":"https://api.github.com/users/trxcllnt/followers","following_url":"https://api.github.com/users/trxcllnt/following{/other_user}","gists_url":"https://api.github.com/users/trxcllnt/gists{/gist_id}","starred_url":"https://api.github.com/users/trxcllnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trxcllnt/subscriptions","organizations_url":"https://api.github.com/users/trxcllnt/orgs","repos_url":"https://api.github.com/users/trxcllnt/repos","events_url":"https://api.github.com/users/trxcllnt/events{/privacy}","received_events_url":"https://api.github.com/users/trxcllnt/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T21:06:58Z","updated_at":"2015-09-03T21:06:58Z","body":"@zenparsing this is a false dichotomy, as that's not the only way to implement the feature."}}