-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bindings: adding process.binding('builtins') method #2180
Conversation
- this method traverses the `modlist_builtin` linked list and returns an object which has binding names as keys and their versions as values
All of these will always have the same version. It might make more sense to do something like
/cc @bnoordhuis |
I wasn't sure about the meaning of the versions, but I figured they could be different (why else would each binding have one). If we return a bindings array we may also exclude the version info all together, i.e. just return an Array instead of an Object. Again I'm not sure of the importance/significance of the version field. |
@thlorenz The version is the same as defined as Since developers can get the module version as |
Sounds good, will update the PR tomorrow. |
@thlorenz may I ask, what is it for? |
@vkurchatkin this is just to get a list of builtin bindings in case you need to know that information. |
Realized that the So for sake of consistency and simplicity I'll create an object instead with |
Adapted the implementation to return the following:
|
I don't see the point. |
That's exactly why it'd be useful if users could get a list of the bindings implemented in the version that they are using. I understand that core itself may have no need for this feature, but this info is very useful for specific tooling (at least it is in my case) and I thought adding it would help others who need it as well. |
I know binding('natives') is used to fast path and prevent overriding natives, with the new loaded bindings wouldn't this make sense to do the same check but on bindings? |
If adding this to |
Everything available through Userland should not have any reason to be using bindings directly. If they do, they are almost certainly doing the wrong thing and should be making a PR or feature request to expose the thing they need properly. |
I get all the arguments, but if a tool needs that info it'd be very useful to get it this way instead of hard coding it somewhere or traversing the However if no one else has that need I'm ok with closing this PR and get that info the hacky way :( |
My primary concern is that adding something to bindings like this makes it look like this is actually supposed to be used. Making this public is also not an option, because having a public list of internal stuff doesn't make much sense |
But why would a tool need that? I'm not seeing the use case. Do you have something in particular in mind? (Not trying to discount the value, just saying that I'm not seeing what exactly the value is.) |
I for one like the ability of having check if something exists if I use |
@thlorenz ... is this still something you'd like to pursue? |
Closing due to lack of activity or response. |
modlist_builtin
linked list and returns anobject which has binding names as keys and their versions as values
Sample Output:
This is in a sense the binding counter part to
process.binding('natives')
, except for bindings and the fact that it doesn't include any sources.