{"action":"created","issue":{"url":"https://api.github.com/repos/staltz/xstream/issues/72","repository_url":"https://api.github.com/repos/staltz/xstream","labels_url":"https://api.github.com/repos/staltz/xstream/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/staltz/xstream/issues/72/comments","events_url":"https://api.github.com/repos/staltz/xstream/issues/72/events","html_url":"https://github.com/staltz/xstream/issues/72","id":164586148,"number":72,"title":"Replace Producer concept with (ES or RxJS) Observable","user":{"login":"staltz","id":90512,"avatar_url":"https://avatars.githubusercontent.com/u/90512?v=3","gravatar_id":"","url":"https://api.github.com/users/staltz","html_url":"https://github.com/staltz","followers_url":"https://api.github.com/users/staltz/followers","following_url":"https://api.github.com/users/staltz/following{/other_user}","gists_url":"https://api.github.com/users/staltz/gists{/gist_id}","starred_url":"https://api.github.com/users/staltz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staltz/subscriptions","organizations_url":"https://api.github.com/users/staltz/orgs","repos_url":"https://api.github.com/users/staltz/repos","events_url":"https://api.github.com/users/staltz/events{/privacy}","received_events_url":"https://api.github.com/users/staltz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/staltz/xstream/labels/issue%20is%20suggestion","name":"issue is suggestion","color":"84b6eb"},{"url":"https://api.github.com/repos/staltz/xstream/labels/weight%202%20(could)","name":"weight 2 (could)","color":"dddddd"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-08T18:13:17Z","updated_at":"2016-07-09T11:04:08Z","closed_at":null,"body":"Xstream is hot streams only, but in rare cases we need cold streams. @TylorS had experienced this hard limitation in a convincing use case. We were discussing what alternative solutions do we have, and we landed on one very interesting possible solution: *to replace Producers in xstream with typical Observables*.\r\n\r\nThat would mean dropping the `{start, stop}` API for a familiar `subscribe` + `subscription.unsubscribe` API. It means everywhere where we expect a Producer, we would expect a cold Observable, e.g. `xs.create(observable)`, where `observable` is an object with a `subscribe(observer)` function.\r\n\r\nThis would enable also very interesting interop with RxJS, because we could do `xs.create(Rx.Observable.of(1,2,3))` for instance. The only requirement that we have from `obs` in `xs.create(obs)` would be that it's an object with `subscribe(observer)` function. Alternatively, we could also support the API `xs.create(subscribe)` where `subscribe` is the function `subscribe(observer)`. So the type signature for `create` would be:\r\n\r\n```js\r\ntype Subscribe<T> = (observer: Observer<T>) => Subscription;\r\n\r\ninterface Observable<T> {\r\n  subscribe: Subscribe<T>;\r\n}\r\n\r\nfunction create<T>(o: Observable<T> | Subscribe): Stream<T>;\r\n```\r\n\r\nIn essence, `xs.create` would behave like a multicast in RxJS, with the additional effect of converting from cold world to hot world **permanently**, since we don't have a conversion path from xs.Stream => Observable.\r\n\r\nThis is for now very experimental, @TylorS will give it a try. He's going to build it as an experiment in a PR. It would affect a lot of the current infrastructure in xstream, and would mean a breaking change, **but** for most xstream/Cycle.js users there wouldn't be any noticeable changes if they are using streams created in drivers and just using operators inside `main()`.\r\n\r\nAnyone else wants to give their opinion about this? Any foreseeable problems that I haven't mentioned? @Widdershin @Hypnosphi @laszlokorte @blesh "},"comment":{"url":"https://api.github.com/repos/staltz/xstream/issues/comments/231528862","html_url":"https://github.com/staltz/xstream/issues/72#issuecomment-231528862","issue_url":"https://api.github.com/repos/staltz/xstream/issues/72","id":231528862,"user":{"login":"Hypnosphi","id":6651625,"avatar_url":"https://avatars.githubusercontent.com/u/6651625?v=3","gravatar_id":"","url":"https://api.github.com/users/Hypnosphi","html_url":"https://github.com/Hypnosphi","followers_url":"https://api.github.com/users/Hypnosphi/followers","following_url":"https://api.github.com/users/Hypnosphi/following{/other_user}","gists_url":"https://api.github.com/users/Hypnosphi/gists{/gist_id}","starred_url":"https://api.github.com/users/Hypnosphi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hypnosphi/subscriptions","organizations_url":"https://api.github.com/users/Hypnosphi/orgs","repos_url":"https://api.github.com/users/Hypnosphi/repos","events_url":"https://api.github.com/users/Hypnosphi/events{/privacy}","received_events_url":"https://api.github.com/users/Hypnosphi/received_events","type":"User","site_admin":false},"created_at":"2016-07-09T11:04:08Z","updated_at":"2016-07-09T11:04:08Z","body":"I've reproduced the usecase mentioned and it works normally\r\nhttps://github.com/staltz/xstream/pull/60#issuecomment-227421302"}}
{"actor":{"display_login":"Hypnosphi"}}