Skip to content

writeable stream: group all properties - #31187

Closed
antsmartian wants to merge 1 commit into
nodejs:masterfrom
antsmartian:writable_refactor
Closed

writeable stream: group all properties #31187
antsmartian wants to merge 1 commit into
nodejs:masterfrom
antsmartian:writable_refactor

Conversation

@antsmartian

@antsmartianantsmartian commented Jan 5, 2020

Copy link
Copy Markdown
Contributor

Refs: #31144 for writable streams.

cc @nodejs/streams

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Jan 5, 2020
@antsmartian
antsmartianforce-pushed the writable_refactor branch 3 times, most recently from 52819a8 to 88f20ecCompareJanuary 5, 2020 06:10
Comment threadlib/_stream_writable.js Outdated
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated

@ronagronagJan 5, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think ObjectDefineProperties defaults enumerable to false, so I don't think these are needed? I'm not sure I understand the above comment about making it explicit? @BridgeAR any idea who is the original author of this comment?

@antsmartianantsmartianJan 5, 2020

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@ronag: That's a good point. I guess we no need to add these properties. For example, I tested the below code and by default the enumerable property is false:

const a = {}
Object.defineProperties(a, { test: { get() { return 'test'} } })
a.test // test
a.propertyIsEnumerable('test') // false

Edit: Guess you have wrongly pinged instead of me :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like that was Calvin. Some people prefer explicit descriptor properties. Probably because not everyone is handling descriptors frequently and knows that their defaults are all false. It should be fine either way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As this also came up in #31287 (comment):

I think it’s better to be explicit here, regardless of what people may know about the default values; partly because it removes cognitive overhead of figuring out what the behaviour is, partly because making it explicit forces code authors to be deliberate about the values they choose.

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
@antsmartian

Copy link
Copy Markdown
ContributorAuthor

@ronag Done. @lpinca: Removed enumerable definition as mentioned here: #31187 (comment)

Could you PTAL again?

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Accidental change?

@lundibundilundibundi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment threadlib/_stream_writable.js Outdated
Comment threadlib/_stream_writable.js Outdated

@lpincalpinca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still LGTM with nits addressed.

Comment threadlib/_stream_writable.js Outdated

@BridgeARBridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with the comments addressed.

@TrottTrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pile-on "LGTM with nits addressed"

Trott pushed a commit that referenced this pull request Jan 9, 2020
PR-URL: #31236
Refs: #31187
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@BridgeAR

Copy link
Copy Markdown
Member

Ping @antsmartian

@antsmartian

antsmartian commented Jan 13, 2020

Copy link
Copy Markdown
ContributorAuthor

Sorry for delay, taken care the comments.. cc @BridgeAR @nodejs/streams

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
PR-URL: #31236
Refs: #31187
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Comment threadlib/_stream_writable.js Outdated
@addaleax

Copy link
Copy Markdown
Member

@antsmartian Can you sqaush the commits here together? CI detects a merge conflict in one of the earlier ones that is then resolved later, but it still fails to rebase because of that. (Also happy to do that for you if you prefer.)

@lundibundilundibundi removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 9, 2020
@ronag

ronag commented Feb 9, 2020

Copy link
Copy Markdown
Member

Another property Writable.writable was added in e559842 which should probably also be included.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@antsmartianantsmartian added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 10, 2020
@antsmartian

antsmartian commented Feb 10, 2020

Copy link
Copy Markdown
ContributorAuthor

@addaleax PTAL.. This should be fine now.

@addaleax

Copy link
Copy Markdown
Member

Landed in 0ac04ec 🙂

addaleax pushed a commit that referenced this pull request Feb 10, 2020
PR-URL: #31187
Refs: #31144
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins

Copy link
Copy Markdown
Contributor

Hey All,

this doesn't land cleanly on v13.x should there be a backport?

@mcollina

Copy link
Copy Markdown
Member

A backport will be good to have to avoid future conflicts.

ronag pushed a commit to nxtedition/node that referenced this pull request Mar 9, 2020
PR-URL: nodejs#31187
Refs: nodejs#31144
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Backport-PR-URL: nodejs#32164
MylesBorins pushed a commit that referenced this pull request Mar 10, 2020
Backport-PR-URL: #32164
PR-URL: #31187
Refs: #31144
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorinsMylesBorins mentioned this pull request Mar 10, 2020
codebytere pushed a commit that referenced this pull request Mar 14, 2020
PR-URL: #31236
Refs: #31187
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 20, 2020
Backport-PR-URL: #32164
PR-URL: #31187
Refs: #31144
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@targostargos mentioned this pull request Apr 22, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.streamIssues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@antsmartian@nodejs-github-bot@BridgeAR@addaleax@ronag@MylesBorins@mcollina@Trott@lpinca@lundibundi@codebytere