-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer: runtime-deprecate Buffer(num) by default #15608
Conversation
If we ever decide to runtime-deprecate something, it should be the |
@addaleax you mean to deprecate the usage of the buffer constructor with a single argument passed in? I also thought about that as only warning in case a number is passed is actually not what helps out anyone who regularly passes in a string and accepts user input for that. I am open for deprecating |
@BridgeAR When I write
Both variants are common patterns, which is why I’m still -1 on runtime-deprecations in general.
I agree, it’s unlikely that this would help more than a handful people, if anyone. |
It won't persuade everyone, but I would be interested to know how much (if any) breakage a CITGM run with this causes compared to "full" deprecation. |
@Trott well, CITGM fails on master, so I doubt running it with this would be informative. |
This |
@Trott ... that would not address the issues with the API. That is, the problem is not with |
@jasnell It addresses one of the issues with the API (the DoS issue).
Correct that it does not address the type-confusion issue. Looking at it through a the lens of people like @seishun who think a runtime deprecation is warranted, "It doesn't address everything" is not terribly persuasive if the only alternative is to address nothing at all. |
@jasnell Although thinking about it more...the DoS issue is only an issue with type confusion in the first place. And switching to In any event, I do find it plausible that the cost of such a limited runtime deprecation may exceed its benefits. Hey, I did say it was probably a terrible idea. 🙃 |
@seishun Since 9.0.0 is out, should this be closed? Rebased and targeted for 10.0.0? Remain open pending something else ? |
If there is consensus that Buffer(num) won't be runtime-deprecated alone (aka either all forms of Buffer() will be deprecated together, or none) then I agree to close. |
Let us put it on the TSC agenda. There was not much discussion here, so I guess it will be best to force it a bit. That way we have more clarity. |
Ref: #15346 (comment) and subsequent conversation after that comment |
@Trott that looks good to me. |
My answer to that is no, because:
|
That's not entirely correct — on older Node.js versions, That said, I am not sure yet if it makes sense to get this in before deprecating |
I would like to see this run against citgm |
This is a "light" version of #15346 that only prints the warning by default when
[new ]Buffer(num)
is used, as suggested by @BridgeAR in #15346 (comment).Most reasons for runtime deprecation by default as listed in #15346 still apply here.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
buffer