Uh oh!
There was an error while loading. Please reload this page.
fs: change default value of position in read and readSync - #37101
fs: change default value of position in read and readSync#37101RaisinTen wants to merge 4 commits into
Conversation
RaisinTen
commented
Jan 27, 2021
Originally posted by @Trott in #36190 (comment) cc @Trott Since you mentioned this idea. |
There was a problem hiding this comment.
Can you keep the null test please? We want null to still works – or mark the PR as semver-major.
EDIT: I've added the semver-major label, you can remove it if you change the code to rollback the behaviour for null.
There was a problem hiding this comment.
I think this should be semver-major as it is supposed to reject a null value for position which was accepted previously. Thanks for adding the label.
There was a problem hiding this comment.
On a second thought, we should probably deprecate it before removing it.
There was a problem hiding this comment.
I added the deprecation warning, test and mentioned the PR link in the YAML. PTAL. 👀
There was a problem hiding this comment.
We should actually keep this with if (position === null) given that the default assignment will not work when position is explicitly passed as null.
There was a problem hiding this comment.
@jasnell Note this was intentional, see #37101 (comment) above.
There was a problem hiding this comment.
@jasnell added the check back in along with a deprecation warning.
There was a problem hiding this comment.
Likewise here, this check should be kept
70f5ff4 to
5145747CompareUh oh!
There was an error while loading. Please reload this page.
aduh95
commented
Jan 29, 2021
Usually we tend to avoid going Runtime deprecation without a doc-only deprecation first – unless there's a security risk we are trying to mitigate, but that's not the case here. You also need to add the deprecation description on Refs: https://github.com/nodejs/node/blob/master/doc/guides/collaborator-guide.md#deprecations |
RaisinTen
commented
Jan 29, 2021
Okay. Should I open a separate PR to make it a doc-only deprecation first? After that lands, we can work on this PR to add the runtime warning. Finally, a PR can be raised to turn it into an EOL deprecation. |
wa-Nadoo
commented
Jan 29, 2021
The proposed default value for |
RaisinTen
commented
Jan 30, 2021
@wa-Nadoo |
Trott
commented
Jan 31, 2021
What's the reason for deprecating |
RaisinTen
commented
Jan 31, 2021
I intended to deprecate |
PoojaDurgad
commented
Mar 29, 2021
need rebase to resolve git-conflicts |
Since the docs mention that `position` in `read` and `readSync` should be an `integer` or a `bigint`, the functions should rather accept what is actually fed into `read`, i.e., `-1` instead of any nullish value.
6a815f7 to
446bdb6CompareRaisinTen
commented
Mar 31, 2021
@PoojaDurgad Thanks for mentioning, I rebased it. |
RaisinTen
commented
Apr 2, 2021
@aduh95 Finally opened the PR to doc-only deprecate this - #38043. :) |
Note that I appreciate the time you spend working in this, but I think Rich has a point. Also if #37948 lands, I'd be -1 to land this.
RaisinTen
commented
Apr 5, 2021
@aduh95 Thank you for the review. Along with deprecating nullish values for Should documenting this be okay if #37948 lands? Even if we document this, wouldn't it feel weird why the default value for |
aduh95
commented
Apr 5, 2021
Changing a default is not necessarily semver-major, as long as it is not a breaking change.
IMHO changing the value in the docs makes sense, whether or not #37948 lands. I don't have a strong opinion regarding deprecation status of nullish values, I tend to be on board for calling it legacy and keep it as is though. |
RaisinTen
commented
Apr 8, 2021
@aduh95 I noticed the validation logic is similar in |
aduh95
commented
Apr 8, 2021
I don't really have an opinion, I guess it would make sense to change all default values documented to |
RaisinTen
commented
Mar 18, 2022
I don't think this is worth the breakage anymore. |
Since the docs mention that
positioninreadandreadSyncshouldbe an
integeror abigint, the functions should rather accept whatis actually fed into
read, i.e.,-1instead of any nullish value.