-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
buf: move buffer.slice to runtime deprecation
#60820
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
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
Signed-off-by: hainenber <[email protected]>
a2450ef to
51c4544
Compare
Signed-off-by: hainenber <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60820 +/- ##
==========================================
- Coverage 88.56% 88.55% -0.01%
==========================================
Files 703 703
Lines 208254 208266 +12
Branches 40156 40162 +6
==========================================
- Hits 184430 184427 -3
- Misses 15828 15839 +11
- Partials 7996 8000 +4
🚀 New features to boost your workflow:
|
Signed-off-by: hainenber <[email protected]>
|
I think there are still remaining There's a failed CI step but it's CPU-based so I think it'd be varied by GHA fleet. |
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 have concerns about moving DEP0158 to runtime deprecation. The current approach will create a very confusing and messy experience for users, particularly in library ecosystem scenarios.
When users pass Buffer instances to libraries that are written to accept and expect Uint8Array, those libraries may legitimately call .slice() on the input. If we add a runtime deprecation warning for Buffer.prototype.slice(), users will see warnings that appear to originate from the library they're using, even though:
- The library is doing nothing wrong
- The library is correctly using standard TypedArray.prototype.slice() semantics
- The library author has no control over whether users pass Buffer instances
This creates a confusing attribution problem where deprecation warnings will cause library maintainers unnecessary reports and support burden.
Instead of deprecating Buffer.prototype.slice() with the intent to remove it, we should deprecate the current behavior with the intent to align it with TypedArray.prototype.slice() in a future major version.
Is there a path forward we can take towards that goal?
As an aside, once it'd be removed wouldn't TypedArray.prototype.slice() just take its place?
|
Might be we can lower the deprecation level a bit to |
IMO this is the strongest reason to progress this deprecation. Buffers are currently unsafe to pass to Uint8Array-accepting libraries that call That being said, it'd probably be a major headache unless application-only, similar to |
Resolves #60813
I have:
Move
Buffer.prototype.slice()to runtime deprecation class. This shouldn't affect existing userland since it's only emitted warning.