-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
src: make Environment optional for RunAtExit #9097
Conversation
Currently, the RunAtExit function definition does not use the Environment parameter. This commit makes the parameter optional and removes it from the call site. I noticed this when trying to figure out how to tackle the TODO for RunAtExit which part of nodejs#4641.
Hmmm – if you introduce a default parameter, shouldn’t that happen in the header where it’s declared (node.cc:212)? I would kind of expect not having a default parameter in the declaration but in the definition to throw the compiler off a bit. |
Sorry I got that backward when reading about default parameters and it's exactly like you stated. I'll add this to the declaration in the header and not in the definition. Thanks! |
I'm -1 on this change, it leaks an implementation detail into a public header and those tend to be excruciatingly painful to change later on. Which TODO are you trying to address? |
I was looking at this TODO and noticed that the |
Ah, so the idea is that There are several ways to skin that cat though. API break, function overload, storing the environment in a thread-local, etc. Writing the code probably won't be that complicated, it's more a matter of figuring out what the best solution long-term is. |
@bnoordhuis Thanks, I'll take a closer look and create a new PR for discussion. |
@bnoordhuis I've taken a stab at this in #9163 |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
src
Description of change
Currently, the RunAtExit function definition does not use the
Environment parameter. This commit makes the parameter optional
and removes it from the call site.
I noticed this when trying to figure out how to tackle the TODO for
RunAtExit which part of #4641.