{"action":"created","issue":{"url":"https://api.github.com/repos/caolan/highland/issues/324","labels_url":"https://api.github.com/repos/caolan/highland/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/caolan/highland/issues/324/comments","events_url":"https://api.github.com/repos/caolan/highland/issues/324/events","html_url":"https://github.com/caolan/highland/pull/324","id":91057266,"number":324,"title":"Extensibility","user":{"login":"quarterto","id":631757,"avatar_url":"https://avatars.githubusercontent.com/u/631757?v=3","gravatar_id":"","url":"https://api.github.com/users/quarterto","html_url":"https://github.com/quarterto","followers_url":"https://api.github.com/users/quarterto/followers","following_url":"https://api.github.com/users/quarterto/following{/other_user}","gists_url":"https://api.github.com/users/quarterto/gists{/gist_id}","starred_url":"https://api.github.com/users/quarterto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quarterto/subscriptions","organizations_url":"https://api.github.com/users/quarterto/orgs","repos_url":"https://api.github.com/users/quarterto/repos","events_url":"https://api.github.com/users/quarterto/events{/privacy}","received_events_url":"https://api.github.com/users/quarterto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/caolan/highland/labels/discussion","name":"discussion","color":"d4c5f9"},{"url":"https://api.github.com/repos/caolan/highland/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/caolan/highland/labels/greenspunning","name":"greenspunning","color":"bfe5bf"},{"url":"https://api.github.com/repos/caolan/highland/labels/interop","name":"interop","color":"fbca04"},{"url":"https://api.github.com/repos/caolan/highland/labels/post-extensibility","name":"post-extensibility","color":"0000ff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-06-25T19:43:38Z","updated_at":"2015-06-27T19:56:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/caolan/highland/pulls/324","html_url":"https://github.com/caolan/highland/pull/324","diff_url":"https://github.com/caolan/highland/pull/324.diff","patch_url":"https://github.com/caolan/highland/pull/324.patch"},"body":"This pull request:\r\n\r\n  1. Exposes the `Stream` class as `module.exports`, and adds logic so it can be called without `new`\r\n  2. Makes `consume`, `observe` and `fork` return streams from the same class\r\n  3. Moves `exposeMethod` to a class method of `Stream` (`_addMethod`)\r\n  4. Adds a `subclass` method to `Stream`\r\n\r\n(1) allows consumers of the library to subclass or modify Stream. (2) facilitates creators of subclasses keeping the subclass context. (3) allows consumers to extend Stream in situ, and subclasses to reuse the logic. (4) is a simple way of extending Stream without bringing your own class implementation.\r\n\r\nWhat do we think? I'm open to bikeshedding on function names, surface area etc. and maybe rebasing this onto 3.0 if we think it should go out after that.\r\n\r\n---\r\nI'd like this to be the basis for pulling `lib/index.js` out into several modules, and possibly reducing our footprint once we realise that half our methods have actually nothing to do with streaming :wink: "},"comment":{"url":"https://api.github.com/repos/caolan/highland/issues/comments/116123629","html_url":"https://github.com/caolan/highland/pull/324#issuecomment-116123629","issue_url":"https://api.github.com/repos/caolan/highland/issues/324","id":116123629,"user":{"login":"quarterto","id":631757,"avatar_url":"https://avatars.githubusercontent.com/u/631757?v=3","gravatar_id":"","url":"https://api.github.com/users/quarterto","html_url":"https://github.com/quarterto","followers_url":"https://api.github.com/users/quarterto/followers","following_url":"https://api.github.com/users/quarterto/following{/other_user}","gists_url":"https://api.github.com/users/quarterto/gists{/gist_id}","starred_url":"https://api.github.com/users/quarterto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quarterto/subscriptions","organizations_url":"https://api.github.com/users/quarterto/orgs","repos_url":"https://api.github.com/users/quarterto/repos","events_url":"https://api.github.com/users/quarterto/events{/privacy}","received_events_url":"https://api.github.com/users/quarterto/received_events","type":"User","site_admin":false},"created_at":"2015-06-27T19:56:02Z","updated_at":"2015-06-27T19:56:02Z","body":"1. Well, you can currently do `_().constructor.prototype`. If it's not documented, it shouldn't be supported. I'm all for removing potential footguns, but maybe sometimes people shouldn't point a gun at their foot and pull the trigger. This pull request doesn't expose the prototype any more than it currently is.\r\n2. I'm happy to rebase this on to 3.0.\r\n3. Not sure what you're getting at here? It doesn't make sense having `use` on `Stream.prototype`, and it needs to use `this` so that chained subclasses work.\r\n\r\nI'm still not sold on lumping different use cases for streams into one object. If each stream class can consume streams from other classes correctly, there's no reason to `use` unrelated modules into the same highland env. Isn't this the exact reason we're making `use` immutable?\r\n\r\nI'd been trying to solve this with redirects. The pipe solution looks cleaner though, thanks."}}