Uh oh!
There was an error while loading. Please reload this page.
stream: simpler stream constructon - #697
Conversation
Via revealing constructor pattern. Referenced to discussion in issue nodejs/readable-stream#102 of iojs/readable-stream
There was a problem hiding this comment.
Technically I wouldn't call this a revealing constructor pattern, since no functionality is "revealed"; you instead just use stream.push and stream.emit("error", ...) and similar.
There was a problem hiding this comment.
I get your point, I will amend the description as well.
Qard
commented
Feb 3, 2015
+1 I like it. It makes the public-facing part of streams somewhat more approachable. They're currently a bit of a nebulous thing to newbies, hence the existence of through/through2. |
sonewman
commented
Feb 3, 2015
@domenic i have updated. |
domenic
commented
Feb 3, 2015
LGTM with minor nits. Someone more familiar with testing practices in io.js should sign off on those. |
sonewman
commented
Feb 3, 2015
@domenic I appreciate your critique. I've never been that great at writing copy 😃 |
Qard
commented
Feb 3, 2015
The |
mafintosh
commented
Feb 3, 2015
I would remove |
domenic
commented
Feb 3, 2015
new is not optional for ES6 classes so it'd be prudent to leave them in to discourage bad habits. |
sonewman
commented
Feb 3, 2015
@Qard I was trying to follow the style of the other stream tests... But I will amend. |
chrisdickinson
commented
Feb 3, 2015
@domenic This is more for my curiosity than anything else: can you still get around that with the usual |
chrisdickinson
commented
Feb 3, 2015
Should we reframe how we're documenting this? Would it be better to integrate the existing examples with the new style of construction, and call out "old-style subclassing" as the standalone topic? |
domenic
commented
Feb 3, 2015
@chrisdickinson nope, constructors defined with class syntax have a throwing [[Call]] internal method. |
sonewman
commented
Feb 3, 2015
@chrisdickinson I thought about this very thing, as I wasn't sure where the documentation should belong. If it went before the inheritance parts then the examples were referring to documentation that was to come. By putting it after solved that problem, but one would have to read the older inheritance way to understand the use of this new simpler pattern. 😕 |
chrisdickinson
commented
Feb 4, 2015
@sonewman Cool. We should definitely revisit the docs later, but that shouldn't be considered blocking for this. I'll leave this open until tomorrow afternoon, at which point I'll merge it if no one has objected. |
sonewman
commented
Feb 4, 2015
@chrisdickinson awesome cheers dude. |
vkurchatkin
commented
Feb 4, 2015
👍 wanted this for a long time |
sonewman
commented
Feb 4, 2015
@chrisdickinson do you want me to squish this into one commit? |
Qard
commented
Feb 5, 2015
This test is failing for me: |
chrisdickinson
commented
Feb 5, 2015
Looks like a typo. Fixing in the merge. |
Adds simplified constructor pattern, allowing users to provide "read", "write", "transform", "flush", and "writev" functions as stream options in lieu of subclassing. Semver: minor PR-URL: #697Fixes: nodejs/readable-stream#102 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
chrisdickinson
commented
Feb 5, 2015
Merged in 50daee7. Note: This is a semver-minor level change. If we don't want the next release to be semver-minor, this should be backed out first. |
sonewman
commented
Feb 5, 2015
@chrisdickinson thanks for fixing the typo, I don't know how many times I ran those tests (but obviously not enough!) |
This allows stream implementers the advantage of being able to pass the necessary stream specific methods to the streams constructor as part of its options upon construction.
Referenced to discussion in issue nodejs/readable-stream#102 of iojs/readable-stream
Please review.
cc: @chrisdickinson @iojs/streams