Skip to content
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: deprecate parent property #8332

Closed

Conversation

thefourtheye
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

buffer

Description of change

The buffer property already exposes the underlying buffer object. So
this property is being deprecated.

Refer: #8266
Refer: #8311


cc @nodejs/buffer

@thefourtheye thefourtheye added buffer Issues and PRs related to the buffer subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Aug 30, 2016
@addaleax
Copy link
Member

Hmm I don’t want to hijack #7964 with a discussion of this specific issue, so I’m commenting here.
I’m basically agreeing with what @bnoordhuis said over there, so far I don’t see any good reason for a runtime deprecation.
We’re in a bit of a pickle here in that a docs-only deprecation is hard because, um, there are no docs on this… I guess my suggestion would be just leaving it undocumented.

@trevnorris
Copy link
Contributor

I find it a bit annoying b/c it's undocumented, and untested. Honestly we might as well just set buf.parent = buf.buffer and be done w/ it.

@thefourtheye
Copy link
Contributor Author

@nodejs/ctc How do we feel about just doc-deprecating this, based on #7964 (comment)?

An in my opinion valid reason for deprecating buffer.parent - in the documentation - is that there should be a canonical way of doing things. It lowers friction for new users and eases maintenance for existing users and is generally always a good thing. That's why I think it's proper for the documentation to say "don't use this thing, use that."

@jasnell
Copy link
Member

jasnell commented Jan 10, 2017

I'm good with a docs-only deprecation

Buffer objects expose the underlying `Uint8Array`'s `buffer` property
by default. This patch formally documents it.
@thefourtheye
Copy link
Contributor Author

Updated the PR with docs-only deprecation. PTAL.

### buf.parent

> Stability: 0 - Deprecated: Use [`buf.buffer`] instead.

Copy link
Member

Choose a reason for hiding this comment

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

Might add here a quick comment saying something like:

The `buf.parent` property is a deprecated alias for `buf.buffer`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack!

`buffer.parent` property is actually a wrapper over `buffer.buffer`
property. This patch actually doc-deprecates it and points the users to
the `buffer.buffer` property.
@thefourtheye
Copy link
Contributor Author

Landed in d708700 and 03d440e

@thefourtheye thefourtheye deleted the buffer-deprecate-parent branch January 18, 2017 06:25
thefourtheye added a commit that referenced this pull request Jan 18, 2017
Buffer objects expose the underlying `Uint8Array`'s `buffer` property
by default. This patch formally documents it.

PR-URL: #8332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
thefourtheye added a commit that referenced this pull request Jan 18, 2017
`buffer.parent` property is actually an alias of `buffer.buffer`
property. This patch actually doc-deprecates it and points the users to
the `buffer.buffer` property.

PR-URL: #8332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
Buffer objects expose the underlying `Uint8Array`'s `buffer` property
by default. This patch formally documents it.

PR-URL: nodejs#8332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
`buffer.parent` property is actually an alias of `buffer.buffer`
property. This patch actually doc-deprecates it and points the users to
the `buffer.buffer` property.

PR-URL: nodejs#8332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@MylesBorins
Copy link
Contributor

@Fishrock123 bot should not be tagging semver major commits for lts

@jasnell jasnell mentioned this pull request Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants