This comes with
https://github.com/nodejs/node/pull/27648#issuecomment-493791072
In future deprecation process with cpp header method, we can add deprecate time to it, so we can make it easier to remove them later.
Maybe also make the deprecate cpp method time clear, two years ?
cc @addaleax @bnoordhuis
I'm excluding n-api because I don't think that's what we're discussing here.
Historically (and I think it's still the case), removal of obsolete C++ APIs basically follows semver-major without a deprecation policy. We've at times printed deprecation warnings but there's no formal policy.
I don't really see a need to introduce one because add-on authors usually have to make changes to their code anyway when a new major Node.js release comes out, if you use V8 or Node APIs directly rather than through nan or n-api.
@bnoordhuis So you inclined to changes such as https://github.com/nodejs/node/pull/27648 can be launched in Semver-major, like Node.js 13 ?
Technically yes, although there's no need to rush it. Those functions aren't maintenance hassles like some of the other things we've removed in the past.
I am struggle with this too. I am actually want to make it in Node.js 13. But @addaleax maybe right on this, Node.js is a big community. Maybe in Node.js 14 ?
Anyway, if we need to remove it a long time. We need a way to track them like put deprecation in comment (git blame and git log not good enough in this case). Thoughts ?
Also should this kind of thing need tsc to discuss.
Also should this kind of thing need tsc to discuss
Not unless there's disagreement on the path to take.
@gengjiawen I don’t mind adding comments to deprecations that indicate when they were added, but only to prevent breaking code too early – I’d definitely not want a situation where we have “timers” that count down until something is going to be removed, or where a deprecation means that something is definitely going to be removed. As Ben said, a lot of the time deprecated methods don’t come with any extra maintenance cost; so there’s really not much of a reason to remove them early (or at all, tbh).
Comment deprecated method like this ?
// todo Remove this in Node.js 14
NODE_DEPRECATED("Use ErrnoException(isolate, ...)",
inline v8::Local<v8::Value> ErrnoException(
int errorno,
const char* syscall = nullptr,
const char* message = nullptr,
const char* path = nullptr) {
return ErrnoException(v8::Isolate::GetCurrent(),
errorno,
syscall,
message,
path);
})
I have a idea maybe automatically track this via comment.
When we make a semver-major release, scan all comments to find deprecation method need to be deleted. Maybe via clang ast.
cc @refack
Is there anything actionable here? Does this need to remain open?