{"action":"created","issue":{"url":"https://api.github.com/repos/cyclejs/core/issues/305","repository_url":"https://api.github.com/repos/cyclejs/core","labels_url":"https://api.github.com/repos/cyclejs/core/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/cyclejs/core/issues/305/comments","events_url":"https://api.github.com/repos/cyclejs/core/issues/305/events","html_url":"https://github.com/cyclejs/core/issues/305","id":153635227,"number":305,"title":"conversion API for dataflows (and drivers)","user":{"login":"whitecolor","id":736697,"avatar_url":"https://avatars.githubusercontent.com/u/736697?v=3","gravatar_id":"","url":"https://api.github.com/users/whitecolor","html_url":"https://github.com/whitecolor","followers_url":"https://api.github.com/users/whitecolor/followers","following_url":"https://api.github.com/users/whitecolor/following{/other_user}","gists_url":"https://api.github.com/users/whitecolor/gists{/gist_id}","starred_url":"https://api.github.com/users/whitecolor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitecolor/subscriptions","organizations_url":"https://api.github.com/users/whitecolor/orgs","repos_url":"https://api.github.com/users/whitecolor/repos","events_url":"https://api.github.com/users/whitecolor/events{/privacy}","received_events_url":"https://api.github.com/users/whitecolor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-08T04:38:41Z","updated_at":"2016-05-09T10:43:28Z","closed_at":null,"body":"Wouldn't it be nice if it was easily possible to write app where you can use components created with different stream libraries in mind?\r\n\r\nScenarios where this can be useful include **migrating** to another stream library, or **evaluating** library, or it would just make possible to use **shared components written for `xstream` in `rx` app** and vice versa.\r\n\r\nConvention for *driver sources* this could be like for **isolate**: A source would provide two helper methods **`convertSource`** and **`convertSink`** that would take adapter of stream lib which they should to convert **to** (for source) and **from** (for sink).\r\n\r\nSo basically those function for driver sources would do the same thing as dorivers do with `runSA` (that is passed as second param) while init - convert driver's native streams to some other streams.\r\n\r\nThough **the problem is see with non driver sources**, there some conventions would be needed too. But basically such sources are either streams or plain object maps with streams.\r\n\r\nAPI could be taken from @TylorS's https://github.com/TylorS/stream-conversions\r\nMaybe `covertSource` and `convertSink` should take not adapter, but conversion interface from `stream-conversions`\r\n\r\nAPI could look like:\r\n```js\r\nimport RxComponent './RxComponent'\r\nimport convert from '@cycle/convert'\r\n\r\nconst XsComponent = convert.rx.to.xstream(RxComponent)\r\n\r\n// so XsComponent can be used transparently in xstream app\r\n```\r\n\r\nAlso `RxComponent` could have like drivers **`streamAdapter`** property that would let *converter* to know from which lib it should convert the dataflow. And API using adapters could look like:\r\n\r\n```js\r\nimport RxComponent './RxComponent'\r\nimport convertToXs from '@cycle/convert/xstream' // converter to xstream\r\nimport rxAdapter from '@cycle/rx-adapter'\r\n\r\nconst XsComponent = convertToXs(RxComponent, rxAdapter)\r\n\r\n// if RxComponent.streamAdapter would be defined:\r\nconst XsComponent = convertToXs(RxComponent)\r\n```\r\n\r\nThis is kind of raw idea. What do you think?"},"comment":{"url":"https://api.github.com/repos/cyclejs/core/issues/comments/217832537","html_url":"https://github.com/cyclejs/core/issues/305#issuecomment-217832537","issue_url":"https://api.github.com/repos/cyclejs/core/issues/305","id":217832537,"user":{"login":"whitecolor","id":736697,"avatar_url":"https://avatars.githubusercontent.com/u/736697?v=3","gravatar_id":"","url":"https://api.github.com/users/whitecolor","html_url":"https://github.com/whitecolor","followers_url":"https://api.github.com/users/whitecolor/followers","following_url":"https://api.github.com/users/whitecolor/following{/other_user}","gists_url":"https://api.github.com/users/whitecolor/gists{/gist_id}","starred_url":"https://api.github.com/users/whitecolor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitecolor/subscriptions","organizations_url":"https://api.github.com/users/whitecolor/orgs","repos_url":"https://api.github.com/users/whitecolor/repos","events_url":"https://api.github.com/users/whitecolor/events{/privacy}","received_events_url":"https://api.github.com/users/whitecolor/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T10:43:27Z","updated_at":"2016-05-09T10:43:27Z","body":"I think (actually sure) auto conversion will not be possible, as inside app we are just dealing with transparent composition of pure functions, and it is non needed, and it should explit thing to avoid ambiguities.\r\n\r\nThe only option would be using auto proxying like it is done in [cycle-hmr](https://github.com/whitecolor/cycle-hmr) but conversion task is not so ubiquitous and need to run in production, so it is not viable."}}