[ I had this as a draft and never actually published it. Sorry for the delay in this information. ]
Is to be removed itself .
Instead, there will now be VTK_DEPRECATED_IN_X_Y_Z
where X, Y, and Z form the version number when the API was deprecated. I’ve gone and done this for the APIs currently deprecated in master
.
Old method:
#include "vtkLegacy.h"
VTK_LEGACY(void someOldMethod());
// in the source
#ifndef VTK_LEGACY_REMOVE
void someOldMethod() {
VTK_LEGACY_BODY(someOldMethod, "VTK next.version")
}
#endif
It now looks like:
#include "vtkDeprecation.h"
VTK_DEPRECATED_IN_9_0_0("a reason for the deprecation and/or guidance on porting")
void someOldMethod();
// in the source
void someOldMethod() {
// This might warrant a new macro, but maybe not.
VTK_LEGACY_BODY(someOldMethod, "VTK next.version")
}
Benefits over the old way:
-
The code doesn’t disappear overnight. Once 9.1.0 is branched, we can go and clean out the 9.0.0 APIs (as they’ll still be in 9.1.0 so they can warn users of these APIs)
-
Warnings always show up and code continues working in the meantime
-
Warnings can be turned off by doing
#define VTK_DEPRECATION_LEVEL VTK_VERSION_CHECK(9, 1, 0)
. This warns about APIs deprecated in 9.0.0, but keeps 9.1.0-deprecations silent.
What won’t be possible with the new way that was with the old: -
changing return values of methods
- Solution: Deprecate the current name and use a new name for the method. There’s one instance which is still on
VTK_LEGACY_REMOVE
today.
- Solution: Deprecate the current name and use a new name for the method. There’s one instance which is still on
-
macros
- Solution: We could deprecate then via
_Pragma
, but that’s not as nice. Let’s just stop having macro APIs . These can continue to useVTK_LEGACY_REMOVE
in the meantime. These aren’t too prevalent, so keeping them around for a while also shouldn’t be too bad.
- Solution: We could deprecate then via
With this will come a versioning scheme to help support this. Releases will be the same, but the master
branch will use a date for the patch level. As an example:
release
-> 9.0.0
-> 9.0.1
-> etc. (all tagged), 9.0.20201030
at branch point -> 9.1.0.rc1
(a tag, should be right after the date branch, so that’s “unobservable”)
master
-> 9.0.20200511
today -> 9.0.20200512
tomorrow -> 9.1.20201031
once 9.1 branches (never tagged)
This means that if you’re tracking master
and need an API added on July 4th, you can do find_package(VTK 9.0.20200704)
and you’re set; 9.1 will satisfy as will an August-based build.
Future improvements:
- wrappers recognize these macros and add
@deprecated
annotations (Java) or decorators (Python) to the wrapped function (docstrings can also get modified) - ParaView gets its own
VTK_DEPRECATED
macro stack based on its version number (no more free ride here ) - We could actually hide these by having them magic away the methods using some SFINAE magic. VTK should always build them however; users just lose access to the declaration based on their minimum VTK request. There are definitely issues with this though (e.g., making a
virtual
disappear affects ABI)
–Ben