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

Add native functions to module info #9072

Open
garazdawi opened this issue Nov 18, 2024 · 3 comments
Open

Add native functions to module info #9072

garazdawi opened this issue Nov 18, 2024 · 3 comments
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM

Comments

@garazdawi
Copy link
Contributor

Is your feature request related to a problem? Please describe.
We need a way to get information about which functions in a module is backed by native code, both nifs or bifs.

Describe the solution you'd like
the funcion lists:module_info(native_functions) should return a list of functions that are implemented using native code. It should return both exported and private functions.

Additional context
#9010

@garazdawi garazdawi added team:VM Assigned to OTP team VM enhancement help wanted Issue not worked on by OTP; help wanted from the community labels Nov 18, 2024
@josevalim
Copy link
Contributor

@garazdawi is there a reason to not use the current lists:module_info(nifs)? From an external point of view, NIFs vs BIFs are mostly an implementation detail, no? :)

@josevalim
Copy link
Contributor

Alternatively, what about exposing -nifs under lists:module_info(attributes)? That would provide a quick way for fetching all NIFs, without having to traverse AST (or without having to load the module, as we could read it from the chunk).

@garazdawi
Copy link
Contributor Author

is there a reason to not use the current lists:module_info(nifs)?

Nope, we can definitely use that for also BIFs. I just did not remember that it existed :)

Alternatively, what about exposing -nifs under lists:module_info(attributes)? That would provide a quick way for fetching all NIFs, without having to traverse AST (or without having to load the module, as we could read it from the chunk).

The -nifs attribute only shows which function could potentially be NIFs, and not which must be NIFs, so that cannot be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants