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

Should _toBuf be renamed and documented? #22425

Closed
ghost opened this issue Aug 21, 2018 · 9 comments
Closed

Should _toBuf be renamed and documented? #22425

ghost opened this issue Aug 21, 2018 · 9 comments
Labels
crypto Issues and PRs related to the crypto subsystem.

Comments

@ghost
Copy link

ghost commented Aug 21, 2018

It seems that we now can use the internal function _toBuf() by exposing it directly from the internal/crypto/util. (See codes at crypto.jsLine 90~91, Line 142):

Now I wonder:

1)Generally speaking, since this is a public function exposed to the public, should it be renamed to toBuf instead of _toBuf()? The latter looks like a private function for inner usages.

2)Should it be documented? Any other suggestions or plans?

Thanks anyway!

@ghost
Copy link
Author

ghost commented Aug 21, 2018

/cc:@nodejs/crypto

@mscdex
Copy link
Contributor

mscdex commented Aug 21, 2018

No, this is an internal helper function and should not be documented.

@addaleax addaleax added the crypto Issues and PRs related to the crypto subsystem. label Aug 21, 2018
@ghost
Copy link
Author

ghost commented Aug 21, 2018

Not exactly I'm afraid……From the code you see that it's exposed:

And it's actually used like this if you want——This example has proved that it can be used, so this isn't an internal one.
tobuf

I wonder whether you expose it for some reasons on purpose, or you exposed it by mistake? I don't think it need exposing, just like other internal functions in the internal folder.

@tniessen
Copy link
Member

"internal helper function" doesn't mean "absolutely inaccessible from outside". We will need to examine whether this needs to be exposed and whether we can either deprecate or remove it from the list of exported functions safely.

@ghost
Copy link
Author

ghost commented Aug 21, 2018

"internal helper function" doesn't mean "absolutely inaccessible from outside". We will need to examine whether this needs to be exposed and whether we can either deprecate or remove it from the list of exported functions safely.

So you mean you're still making experiment? And if this is confirmed to be exposed, maybe the related doc will be changed?

@mscdex
Copy link
Contributor

mscdex commented Aug 21, 2018

Anything underscore-prefixed indicates that something is "private". Most of these instances could probably be transitioned to internal symbols now to reduce their "publicness".

@joyeecheung
Copy link
Member

In general access to properties/methods prefixed with underscores is considered deprecated (with a few unfortunate exceptions). We only document them when we absolutely have to (e.g. there is no way to remove them without breaking the ecosystem and they are already well-known), otherwise we just keep them as-is with plans to either migrate them to symbol properties (with or without an official deprecation cycle depending on the ecosystem usage), or replace them with an official public API.

@joyeecheung
Copy link
Member

Also, on _toBuf in particular, there was discussion about deprecating it around 8.x #11138 I guess we just forgot to follow up on that?

@ghost
Copy link
Author

ghost commented Aug 22, 2018

@joyeecheung:Ah yes, maybe you can watch this issue :)

tniessen added a commit to tniessen/node that referenced this issue Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants