-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
N-API: Remove reference to node internals #13892
N-API: Remove reference to node internals #13892
Conversation
We must keep src/node_api.cc free of node internals because it must build cleanly outside of node as well - for example in node_addon_api.
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.
LGTM
@@ -17,7 +17,9 @@ | |||
#include <vector> | |||
#include "uv.h" | |||
#include "node_api.h" | |||
#include "node_internals.h" | |||
|
|||
// We must avoid making use of node internals because this file must compile |
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.
Super-nitpicky- consider pointing to node-addon-api as an example here
Is there a way to validate this in CI somehow so it doesn't break in the future? I'm not sure of the best way other than having some bizarre CI job that clones node-addon-api, replaces node_api.cc in it and then runs the node-addon-api test- surely there's a better way? |
@digitalinfinity thats probably a good idea to try for ci validation. We should likely open a separate issue for that. It would not necessarily need node-addon-api, unless it provides some elements needed to compile node_api.cc |
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.
If it's going to live in the node source tree, it should be idiomatic code.
If you want to make it build outside of the tree, provide facsimiles in out-of-tree builds.
On that topic: the use of assert() should be replaced by CHECK macros.
@bnoordhuis I'm not sure being quite that black/white makes sense to me in this case. It's a small delta in order to avoid extra work to keep a separate copy which then needs to be kept in sync. Is it really that big a deal in this case ? |
@bnoordhuis especially since we're only talking about no more than one
reference to node::arraysize()
…On Wed, Jun 28, 2017 at 10:21 PM, Michael Dawson ***@***.***> wrote:
@bnoordhuis <https://github.com/bnoordhuis> I'm not sure being quite that
black/white makes sense to me in this case. It's a small delta in order to
avoid extra work to keep a separate copy which then needs to be kept in
sync. Is it really that big a deal in this case ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13892 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA7k0YnVmRZIWGnEqFm6CZ1xC_xtX2Szks5sIqfUgaJpZM4OEAu5>
.
|
I'm not sympathetic to the "it's more work" argument, that's the price of upstreaming. The out-of-tree project will become irrelevant over time whereas the in-tree version will stay around for many years to come.
Also that calls to assert() should be replaced by CHECK macros, and I'm sure there is more. And if not now, then future refactorings are sure to introduce them. n-api gets no special treatment. That's demanding everyone else do more work in order that the n-api people can get away with doing less. |
After seeing how #13971 copy/pastes whole functions from node.cc to node_api.cc I'm even more convinced the rules for n-api need to be tightened, not loosened. It's an unacceptable lowering of the code quality. |
We've decided to use our own version of |
We must keep src/node_api.cc free of node internals because it must
build cleanly outside of node as well - for example in node_addon_api.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)