sxs-collaboration / spectre

SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics.
https://spectre-code.org
Other
160 stars 189 forks source link

Deprecating code #1819

Open nilsvu opened 4 years ago

nilsvu commented 4 years ago

Feature request:

This issue is to discuss our policy for deprecating code. It came up in this comment thread: https://github.com/sxs-collaboration/spectre/pull/1817#discussion_r349931786

This is my suggestion from #1817:

Component:

nilsvu commented 4 years ago

Re https://github.com/sxs-collaboration/spectre/pull/1817#discussion_r349952589:

nilsdeppe commented 4 years ago

You're going to love this idea ;)

So we could have a macro roughly as follows:

/// MESSAGE is the deprecation message
/// DATE is the date on which this is being deprecated
#define DEPRECATED(MESSAGE, DATE) \
  BOOST_PP_IF(BOOST_PP_GREATER(CURRENT_DATE,
      DATE + 6 /* need to do some math here to get month right */),
    static_assert(false, "remove deprecated code!");, [[deprecated, MESSAGE]])

This will cause compile failures six months after code is deprecated making it clear that the code has been deprecated long enough to be removed. The downside is that on the first of every month we could have builds break and someone needs to fix it, which is kind of annoying.

An alternative mechanism would be:

#define DEPRECATED(DATE, MESSAGE) [[deprecated, MESSAGE]]

and have a CI check run only on develop flag old code either by (in order of increasing difficulty):

nilsvu commented 4 years ago

Yay more macros :)

nilsdeppe commented 4 years ago

I knew you'd love it ;)

nilsvu commented 4 years ago
nilsdeppe commented 4 years ago
nilsvu commented 4 years ago

You can always hard-code a repo URL in the workflow and check the ${{ github.repository }} against it. But I suppose the idea is that actions run on forks the same way they do on the base repo.