GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: simpler stream constructon by sonewman · Pull Request #697 · nodejs/node

Conversation

@sonewman

@sonewman sonewman commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sonewman
stream: simpler stream constructon
5edbe1a
Via revealing constructor pattern. Referenced to discussion in issue nodejs/readable-stream#102 of iojs/readable-stream
domenic
domenic reviewed Feb 3, 2015
View reviewed changes
Comment thread doc/api/stream.markdown Outdated

@domenic domenic Feb 3, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sonewman sonewman Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point, I will amend the description as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Qard

Qard commented Feb 3, 2015

Copy link
Copy Markdown
Member

+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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman
simplified documentation
0b6fcb0
@sonewman

sonewman commented Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

@domenic i have updated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123 Fishrock123 added stream Issues and PRs related to Node.js streams. semver-minor PRs that contain new features and should be released in the next minor version. discuss Issues opened for discussion and feedback. labels Feb 3, 2015
domenic
domenic reviewed Feb 3, 2015
View reviewed changes
Comment thread doc/api/stream.markdown Outdated

@domenic domenic Feb 3, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/the need of//

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@domenic

domenic commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

LGTM with minor nits. Someone more familiar with testing practices in io.js should sign off on those.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman
minor copy updates
8d72897
@sonewman

sonewman commented Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

@domenic I appreciate your critique. I've never been that great at writing copy 😃

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman
renamed test files
8bc8805
@Qard

Qard commented Feb 3, 2015

Copy link
Copy Markdown
Member

The console.log('ok') bits don't need to be there, and I'd refactor the writable test to use one process.on('exit', ...) and no unnecessary one/two functions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mafintosh

mafintosh commented Feb 3, 2015

Copy link
Copy Markdown
Member

I would remove new from the examples since that is optional. Other than that LGTM from me

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@domenic

domenic commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

new is not optional for ES6 classes so it'd be prudent to leave them in to discourage bad habits.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman

sonewman commented Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

@Qard I was trying to follow the style of the other stream tests... But I will amend.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman
minor refactor of tests
fab2f66
@chrisdickinson

chrisdickinson commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

@domenic This is more for my curiosity than anything else: can you still get around that with the usual if (!(this instanceof Classname)) return new Classname(...args) in constructor(){}? If that's the case, I imagine we'll continue to take the "new is encouraged but not required" approach.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson

chrisdickinson commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@domenic

domenic commented Feb 3, 2015

Copy link
Copy Markdown
Contributor

@chrisdickinson nope, constructors defined with class syntax have a throwing [[Call]] internal method.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman

sonewman commented Feb 3, 2015

Copy link
Copy Markdown
Contributor Author

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?

@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. 😕

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson

chrisdickinson commented Feb 4, 2015

Copy link
Copy Markdown
Contributor

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman

sonewman commented Feb 4, 2015

Copy link
Copy Markdown
Contributor Author

@chrisdickinson awesome cheers dude.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vkurchatkin

vkurchatkin commented Feb 4, 2015

Copy link
Copy Markdown
Contributor

👍 wanted this for a long time

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonewman

sonewman commented Feb 4, 2015

Copy link
Copy Markdown
Contributor Author

@chrisdickinson do you want me to squish this into one commit?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123 Fishrock123 removed the discuss Issues opened for discussion and feedback. label Feb 4, 2015
@Qard

Qard commented Feb 5, 2015

Copy link
Copy Markdown
Member

This test is failing for me:

=== release test-stream-writable-constructor-set-methods ===                   
Path: parallel/test-stream-writable-constructor-set-methods
assert.js:87
  throw new assert.AssertionError({
        ^
AssertionError: null == [Function: _writev]
    at process.<anonymous> (/home/sbelanger/Documents/io.js/test/parallel/test-stream-writable-constructor-set-methods.js:31:10)
    at process.emit (events.js:119:20)
Command: out/Release/iojs /home/sbelanger/Documents/io.js/test/parallel/test-stream-writable-constructor-set-methods.js
[00:43|% 100|+ 812|-   1]: Done                                                
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson

chrisdickinson commented Feb 5, 2015

Copy link
Copy Markdown
Contributor

Looks like a typo. Fixing in the merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisdickinson pushed a commit that referenced this pull request Feb 5, 2015
@sonewman @chrisdickinson
stream: simpler stream constructon
50daee7
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: #697
Fixes: nodejs/readable-stream#102
Reviewed-By: Chris Dickinson <[email protected]>
@chrisdickinson

chrisdickinson commented Feb 5, 2015

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson chrisdickinson closed this Feb 5, 2015
@sonewman
sonewman deleted the simpler-stream-construction branch February 5, 2015 09:11
@sonewman

sonewman commented Feb 5, 2015

Copy link
Copy Markdown
Contributor Author

@chrisdickinson thanks for fixing the typo, I don't know how many times I ran those tests (but obviously not enough!)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig cjihrig mentioned this pull request Feb 6, 2015
dns - add 'all' option to dns.lookup #744
Closed
@rvagg rvagg mentioned this pull request Feb 9, 2015
Release proposal: v1.2.0 #768
Closed
@leonardoadame leonardoadame mentioned this pull request Feb 2, 2024
[Snyk] Security upgrade babel-eslint from 7.2.3 to 10.1.0 leonardoadame/node#633
Open
@jefeaguila jefeaguila mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities jefeaguila/node#37
Open
@buzzlightyear726 buzzlightyear726 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities buzzlightyear726/node#39
Open
@jefeaguila jefeaguila mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities jefeaguila/node#41
Open
@buzzlightyear726 buzzlightyear726 mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities buzzlightyear726/node#44
Open
@Renukaloch Renukaloch mentioned this pull request Feb 11, 2024
[Snyk] Fix for 1 vulnerabilities Renukaloch/node#26
Open
@buzzlightyear726 buzzlightyear726 mentioned this pull request Feb 12, 2024
[Snyk] Fix for 1 vulnerabilities buzzlightyear726/node#51
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

semver-minor PRs that contain new features and should be released in the next minor version. stream Issues and PRs related to Node.js streams.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@sonewman @Qard @domenic @mafintosh @chrisdickinson @vkurchatkin @Fishrock123
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.